Fibonacci Numbers: Naive vs Memoized vs Bottom-Up DP
Compare the performance of computing the n-th Fibonacci number using: (i) Naive tree recursion, (ii) Memoized recursion, and (iii) Bottom-up Dynamic Programming.
| Method | Result | Basic Operations (Calls / Iterations) | Time (ms) | Time Complexity | Auxiliary Space |
|---|
Stack (Array-Based)
Fixed-capacity stack built on a plain array from first principles. Test push, pop, peek, overflow, and underflow.
Sorting Algorithms Lab
Explore first-principles implementations of Bubble, Selection, Insertion, Merge, and Quicksort (featuring the course first-element pivot with Yellow/Green partition and randomised pivot).
Side-by-Side Performance Comparison (Identical Input)
Every algorithm ran on the exact same dataset. Notice the difference in comparisons and swaps!
| Algorithm | Comparisons | Swaps / Moves | Array Writes | Execution Time | Best Case | Average Case | Worst Case | Extra Space | Stable |
|---|
Time Complexity Analysis & Empirical Benchmark
Measure running times and operation counts experimentally across Random, Already Sorted, and Reverse Sorted inputs. Repeats each run 3 times and averages the results to verify Big-O theory.
Growth Chart: O(n²) Sorts (Random Input)
Growth Chart: O(n log n) Sorts (Random Input)
Theoretical Analysis & Discussion
You may notice running times and chart heights fluctuate between benchmark runs. This occurs because the graphs plot live wall-clock time (milliseconds) measured in a browser JIT environment, which is subject to JavaScript V8 engine warm-up, garbage collection (GC) pauses, and OS CPU scheduling. Additionally, the charts auto-scale their vertical axis to the peak measured time of each specific run. Despite small millisecond jitter, the fundamental asymptotic growth rate remains constant: O(n²) sorts experience quadratic surges (~4x time when doubling n), while O(n log n) sorts maintain near-flat, efficient scalability (~2.1x time when doubling n).