All lessonsOpen Open Open Open Open
7. Sorting
Sorting complexity cheat sheet
0 of 5 activities0%
Reading 1
What to remember
Comparison sorts need Ω(n log n) in the worst case in general.
Stable: merge sort (typical), insertion, bubble (careful). Unstable: quick, heap, selection.
Prefer library sort (introsort) in production; know the classics for interviews.
Check 2
Lower bound
Comparison-based sorting lower bound is
Fill in 3
Stable meaning
Try it 4
std::sort
Use the library.
main.cpp
Loading editor…
Output will appear here.
Assignment 5
Is sorted?
Read n and n ints. Print yes if nondecreasing, else no.
main.cpp
Loading editor…