Algorithm Visualizer
Runs in browserVisualize recursion, trees, and graph algorithms
Recursion
Sorting
Binary Trees
Graphs
How to Use
Select an algorithm and run visualization.
You will see:
- Step-by-step Execution
- Recursion Stack or Graph Traversal
- Variable state changes
Fibonacci Recursion Step 1 / 1
Call Stack
Execution Log
Understanding Algorithms
Algorithms are the heart of computer science. This visualizer helps you build intuition for how common algorithms execute, manage state, and process data structures.
Time Complexity (Big O)
Understanding how algorithms scale with input size (n):
| Notation | Name | Example |
|---|---|---|
| O(1) | Constant | Array access, Hash map lookup |
| O(log n) | Logarithmic | Binary Search |
| O(n) | Linear | Linear Search, Tree Traversal |
| O(n log n) | Linearithmic | Merge Sort, Quick Sort, Heap Sort |
| O(n²) | Quadratic | Bubble Sort, Selection Sort |
| O(2ⁿ) | Exponential | Recursive Fibonacci |
💡 Pro Tips
- Recursion is elegant but can cause Stack Overflow errors if too deep
- Binary Search requires sorted data to work
- DFS uses a Stack (LIFO), BFS uses a Queue (FIFO)
- Merge Sort is stable and efficient (O(n log n)) for large datasets
References & Further Reading
- VisuAlgo - Advanced algorithm visualizations.
- GeeksforGeeks: Algorithms - Comprehensive tutorials and examples.
Algorithm Types
Tree & Graph Traversal
- BFS (Breadth-First Search): Explores neighbors layer by layer. Great for shortest paths in unweighted graphs.
- DFS (Depth-First Search): Explores as far as possible along each branch before backtracking. Useful for topological sorting and puzzles.
Recursion
- Base Case: The condition that stops the recursion.
- Recursive Step: The function calls itself with a smaller input.
- Call Stack: Tracks active function calls (visualized in the tool).
💡 Interview Tips
- Always start by clarifying input constraints and edge cases.
- Explain your thought process out loud before writing code.
- Know the time and space complexity of your solution.
- Practice implementing common algorithms like DFS, BFS, and Binary Search from scratch.