Sorting

  • Quick Sort: O(nlogn) in practice but O(n²) worst-case, sort around pivot

  • Merge Sort, Heap Sort: Consistent O(n log n)

  • Bubble Sort, Insertion Sort, Selection Sort: Simple O(n^2)

  • Counting Sort, Radix Sort**: Non-comparison sorts, efficient for specific use cases.**

  • Tim Sort: Highly optimized for real-world data and widely used in standard libraries including JS and Python, basically combined Merge Sort and Insertion Sort

Last updated