Live trace
What the computer is doing
ALGORITHMS / BEGINNER
Step through three foundational sorting algorithms and watch the array, variables, and C++ code move together.
SELECTION SORT
What the computer is doing
Tip: use the Left and Right arrow keys to move through the trace.
QUICK COMPARISON
Does few swaps. Useful when writing is costly.
Time: O(n^2)Simple neighbour comparisons. Great for learning swaps.
Time: O(n^2)Efficient for small or nearly sorted lists.
Best case: O(n)