Interactive Lab

Sorting Algorithm Visualizer

Explore how classic sorting algorithms behave step-by-step, and compare their formulas and Big-O complexity.

Bubble Sort

Repeatedly compares neighboring values and swaps them until the largest values bubble to the end.

Formula

Comparisons: Σ(i=1→n-1) i = n(n-1)/2

Pseudocode

for i = 0 to n - 2
  for j = 0 to n - 2 - i
    if A[j] > A[j + 1]
      swap(A[j], A[j + 1])

Complexity

Best: O(n)

Average: O(n²)

Worst: O(n²)

Space: O(1)

Steps: Press Start to run.

SQL Demo (Read-Only)

OCI Autonomous Database GET Demo

Queries are hardcoded on the backend for safety. The frontend only chooses a predefined query id.