0Comparisons
0Swaps / writes
–Time (avg)
–Extra space
Pseudocode
About
How to use it
Pick an algorithm, press Play and watch the bars. Amber bars are being compared, red bars are being swapped or written, green bars are in their final place. Use Step to move one operation at a time while following the highlighted pseudocode line.
Which sort should you use?
- Bubble, selection, insertion — O(n²); simple to write, fine for tiny arrays. Insertion sort is very fast on nearly sorted data.
- Merge sort — always O(n log n) and stable, but needs O(n) extra memory.
- Quick sort — O(n log n) on average and very fast in practice; O(n²) worst case with bad pivots.
- Heap sort — O(n log n) worst case with O(1) extra space, but not stable.
Try this
Choose “Nearly sorted” and compare insertion sort with selection sort — count the comparisons. Then try “Reversed” with quick sort (last-element pivot) to see its worst case.
More Interview & Career
🗄️SQL PracticeOnline SQL playground with 27 interview challenges
🎤Interview Question Practice125+ HR, DSA, SQL, system design & AI/ML questions
⭐STAR Answer BuilderBuild structured answers to behavioural questions
📝Resume Bullet BuilderWrite strong XYZ resume bullets with action verbs & metrics
💰Salary Calculator (CTC → In-Hand)India CTC to in-hand salary, new vs old tax regime
⏱️Big-O Cheat Sheet & QuizTime & space complexity tables, growth chart and quiz