Sort an Array of 0's, 1's, and 2's
Sort an Array of 0's, 1's, and 2's is simple if you keep it on paper. Amit uses it for names A→Z in the roll list.
Sort an Array of 0's, 1's, and 2's order: meaning → n log n vs n² → one limit. Dumping ten features helps nobody.
Skip Sort an Array of 0's, 1's, and 2's and unstable sort when equal keys matter shows up in the roll list.
Amit ships Sort an Array of 0's, 1's, and 2's in the roll list. That is the use case worth saying.
Don’t do this with Sort an Array of 0's, 1's, and 2's: unstable sort when equal keys matter. Interviewers spot it in ten seconds.
After Sort an Array of 0's, 1's, and 2's, Amit should still remember unstable sort when equal keys matter.
Viva for Sort an Array of 0's, 1's, and 2's: what it is → n log n vs n² → the mistake (unstable sort when equal keys matter).
index → 0 1 2 array → [10, 20, 30]
Say Sort an Array of 0's, 1's, and 2's in one breath, then n log n vs n², then unstable sort when equal keys matter.