Knapsack — Subset Sum Recursion Visualizer
Watch the recursive call tree grow, with live backtracking, next to a synced code trace.
Input
List (ray)
Target sum
Build tree
Slide example (sum 15)
No solution (sum 1)
5 items (sum 30)
6 items (sum 9)
Playback
↺ Reset
◀ Step
▶ Play
Step ▶
Speed
Auto-follow active node
Pseudocode
Trace log
Selected call
Click any node in the tree, or step through the trace, to inspect a call.
+
−
Fit
not yet called
currently on the call stack
returns True
returns False
final solution path
no run yet