Claviro

Algorithms

Sorting Algorithms Overview

Before You Apply

First observe the behavior in Explore mode, then switch to Apply to test each operation with intent.

Core Idea

Sorting is fundamental for efficient searching, analysis, and data organization. Different algorithms suit different scenarios based on time complexity and space usage.

Observe This First

Bubble Sort: O(n²) - Simple but slow, stable, in-place

Then Apply

Database sorting: Uses variants of Quick Sort

Sorting Algorithms Overview Lab

Sorting compares values and reorders bars from smaller to larger.

012345

Ready|Waiting for bubble sort

Time: O(n^2)|Space: O(1)

Current
Comparing
Sorted
Swapping

Pseudocode

1repeat passes across the array
2compare adjacent elements
3swap if left value is larger
4mark the pass boundary as sorted

Sorting becomes easier to see when compare, swap, and sorted states are visually separated.

Explore mode: click bars to inspect values and positions.

Understanding the Observation

What did you observe?

Merge Sort: O(n log n) - Fast, stable, requires extra space

Why did this happen?

Bubble Sort: O(n²) - Simple but slow, stable, in-place

Apply with purpose

In Apply mode, test one operation and explain its complexity before running the next.

Predict next

Before clicking run, predict the next index/pointer movement and then verify it.