Every comparison, swap and write, recorded up front and played back frame by frame. Scrub the timeline, step one operation at a time, and watch where the O(n²) algorithms lose to the O(n log n) ones — and where they don’t.
The tradeoffs that matter in practice: whether it allocates, whether equal elements keep their original order, and how badly the worst case hurts.
| Algorithm | Best | Average | Worst | Space | Stable | Where it wins |
|---|