Recursion Tree Visualizer
Pick a recursive function, choose an input, and step through the actual call tree as it builds.
Runs entirely in your browser. No data is sent to a server.
Free Recursion Tree Visualizer
Recursion is easy to write and hard to see — our free recursion tree visualizer makes it visible. Pick a classic recursive function like factorial or Fibonacci, choose an input, and watch the actual call tree build itself, call by call, with each node showing its arguments, its recursion depth, and eventually its return value.
Step through the animation at your own pace to see exactly when each call is made and when it returns — and for Fibonacci, watch how quickly the number of calls explodes as n grows, a vivid illustration of why naive recursive Fibonacci is so inefficient without memoization.
Built for computer science students learning recursion, call stacks, and algorithmic complexity for the first time. No sign-up, no downloads — just an interactive way to finally see how recursion works. See the About and FAQ sections below for more.
About the Recursion Tree Visualizer
How It Works & Methodology
Pick factorial, naive Fibonacci, or binary search, choose an input, and the tool builds the real call tree in actual call order (pre-order calls, post-order returns), rendering it as an SVG diagram you can step through.
Features
Preset functions
Factorial, Fibonacci, and binary search, each with a sensible input cap.
Step-through animation
Play, pause, or step call-by-call through the actual execution order.
Call-stack depth
Each node is labelled with its recursion depth.
Call-count comparison
For Fibonacci, the exponential call blow-up is contrasted with an iterative count.
Mathematical Basis & Practical Verification
The Recursion Tree Visualizer is built on discrete mathematics, computer architecture, and algorithm analysis standards (including IEEE 754 floating-point rules, two's complement bit-width modular arithmetic, and asymptotic recurrence relations). Free recursion tree visualizer that animates the actual call tree for factorial, Fibonacci, or binary search, showing call order, recursion depth, and return values. Key capabilities built into this tool include factorial, fibonacci, and binary search call trees, step-through animation, call-stack depth indicator, and total call count.
All computations for the Recursion Tree Visualizer follow the definitions established in IEEE Standard for Floating-Point Arithmetic (IEEE 754-2019) (IEEE Computer Society) and Dictionary of Algorithms and Data Structures (DADS) (National Institute of Standards and Technology (NIST)). Because the solver evaluates inputs locally in IEEE 754 double-precision arithmetic (53-bit significand, ~15–17 significant decimal digits) and is regression-tested against deterministic reference fixtures in tests/recursion-tree.spec.ts, you can inspect boundary conditions, verify dimensional consistency across computer science units, and cross-check each intermediate step against textbook solutions.
Related Calculators & Tools
Watch sorting algorithms run step by step — bubble, selection, insertion, merge, quick, and heap sort — with adjustable size and speed and Big-O complexity info.
Convert between binary, octal, decimal and hexadecimal live as you type, with step-by-step positional-weight and division working.
Apply AND, OR, XOR, NOT, NAND, NOR and bit shifts to decimal, hex, or binary numbers with aligned bit-column visualization.
Add, subtract, and multiply binary numbers with full carry, borrow, and partial-product working shown.
Authoritative Sources & Standards
- IEEE Standard for Floating-Point Arithmetic (IEEE 754-2019) — IEEE Computer Society
- Dictionary of Algorithms and Data Structures (DADS) — National Institute of Standards and Technology (NIST)
Frequently Asked Questions
What functions can I visualize?
Factorial, naive Fibonacci, and a divide-and-conquer example like binary search's call splits.
Can I step through the recursion call by call?
Yes, play/pause/step controls animate the tree building in actual call order.
Why is there a cap on the input value?
Recursion trees grow exponentially for some functions (like Fibonacci); the cap keeps the diagram readable and the browser responsive.
What does the tool show about call-stack depth?
Each node is labelled with its recursion depth, and the current depth is highlighted during the animation.
Why does Fibonacci's tree get so big so fast?
Naive recursive Fibonacci recomputes the same subproblems repeatedly, causing exponential call growth — the tool visualizes and counts this.
Does it show return values?
Yes, once a call returns, its value is displayed on its node.
Is this useful for learning algorithm complexity?
Yes, seeing the actual call count helps build intuition for why some recursive approaches are inefficient.