← DSA I Interactive execution lab
Sorting Arena
Run the same values through three classic algorithms and inspect every operation.
Choose an algorithm
1void bubbleSort(std::vector<int>& a) {2for (size_t i = 0; i + 1 < a.size(); i++) {3bool swapped = false;4for (size_t j = 0; j + 1 < a.size() - i; j++) {5if (a[j] > a[j + 1]) {6std::swap(a[j], a[j + 1]);7swapped = true;8}9}10// largest remaining value settled on the right11if (!swapped) break;12}13}
start
Step 1 of 37Ready to bubble
7 [0]
3 [1]
5 [2]
2 [3]
9 [4]
1 [5]
Active indices Sorted region
Pass0
Comparisons0
Writes0
Swaps0
1 / 37