Sorting Algorithms Visualized
Watch Bubble Sort, Selection Sort, and Insertion Sort in action with animated bar charts.
Category: Algorithms
·
v1.0.0
Step 1 of 4
Step 1: What is Sorting?
Sorting means arranging items in a specific order — usually smallest to largest (ascending) or largest to smallest (descending). It is one of the most fundamental operations in computer science.
Why does sorting matter?
- Searching sorted data is much faster (e.g., binary search)
- Sorted data is easier for humans to read and analyze
- Many algorithms require sorted input to work correctly
Time Complexity tells us how an algorithm's speed scales with input size n:
- O(n²) — Simple sorts (Bubble, Selection, Insertion). Fine for small datasets, but slow for large ones.
- O(n log n) — Advanced sorts (Merge Sort, Quick Sort). Much faster for large datasets.
Below, see the difference between an unsorted and sorted array visualized as bars:
Unsorted
Sorted
About This Lab
Sorting is one of the most fundamental operations in computer science. In this lab, you'll visualize how three classic sorting algorithms work: Bubble Sort, Selection Sort, and Insertion Sort. Watch animated bar charts that show each comparison and swap in real time, and compare their performance.
How It Works
- Read the explanation of each sorting algorithm
- Click 'Sort' to watch the algorithm animate step by step
- Click 'Shuffle' to reset with new random data
- Compare how different algorithms perform
- Complete the quiz to test your knowledge