Algorithms
Algorithm Logic
Dijkstra's: Finds the shortest path by visiting nodes with the smallest distance from the start ($g(n)$). Here, $h(n)$ is always 0.
A* Search: Uses $f(n) = g(n) + h(n)$. $g(n)$ is cost from start, $h(n)$ is heuristic estimate to target.
| Node | g(n) | h(n) | f(n) |
|---|
No calculations yet...
Traversal Logic
- Pre-order: Root → Left → Right
- In-order: Left → Root → Right
- Post-order: Left → Right → Root
- Breadth-first: Level by level from top to bottom.
Complexity & Big O Notation
| Notation | Growth | Example |
|---|---|---|
| O(1) | Constant | Array index access |
| O(log n) | Logarithmic | Binary Search |
| O(n) | Linear | Linear Search |
| O(n log n) | Linearithmic | Merge Sort |
| O(n²) | Polynomial | Bubble Sort |
Efficiency Chart
Algorithm Stages & Logic
Select an algorithm and click start to begin visualisation...