Hitesh Sahu
Hitesh SahuHitesh Sahu
  1. Home
  2. โ€บ
  3. posts
  4. โ€บ
  5. โ€ฆ

  6. โ€บ
  7. 6 Sorting

Loading โณ
Fetching content, this wonโ€™t take longโ€ฆ


๐Ÿ’ก Did you know?

๐Ÿฆฅ Sloths can hold their breath longer than dolphins ๐Ÿฌ.

๐Ÿช This website uses cookies

No personal data is stored on our servers however third party tools Google Analytics cookies to measure traffic and improve your website experience. Learn more

Loading โณ
Fetching content, this wonโ€™t take longโ€ฆ


๐Ÿ’ก Did you know?

๐ŸŒ Bananas are berries, but strawberries are not.
Programming

    AI-AgenticAI

    AI-DeepLearning

    AI-GenAI

    AI-Infrastructure

    AI-Machine-Learning

    AI-Math

    AWS

    Azure

    kubernetes

    Management

    Programming
    • ๐Ÿงฑ Data Structures: Arrays, Stacks, Queues, Heaps, Hash Tables, Tries & Graphs

    • ๐ŸŒฒ Trees Deep Dive: BST, AVL Rotations, Red-Black Trees, B-Trees & B+ Trees

    • ๐Ÿ•ธ๏ธ Graph Data Structures: Adjacency List vs Matrix, BFS & DFS

    • ๐Ÿ”ข Algorithmic Complexity: Big O From First Principles

    • ๐Ÿ”Ž Searching Algorithm Complexity ๐Ÿ“–

    • โšก Sorting Algorithm Complexity ๐Ÿ“–

    • ๐Ÿ—„๏ธ Database Comparison ๐Ÿ“–

    • Ansible: Agentless Configuration Management

    • CI/CD Pipelines: From Commit to Production

    • Unix Internals: Processes, File Descriptors, and Syscalls

    • Programming Index


    Terraform

    Z_Appendix

Cover Image for โšก Sorting Algorithm Complexity ๐Ÿ“–
Programming

โšก Sorting Algorithm Complexity ๐Ÿ“–

Best, average, and worst case complexity and stability for Quick Sort, Merge Sort, Timsort, Heap Sort, and every other major sorting algorithm โ€” quick revision notes.

Algorithms
Sorting
Big O
Complexity
Study Notes
โ† Previous

๐Ÿ”Ž Searching Algorithm Complexity ๐Ÿ“–

Next โ†’

๐Ÿ—„๏ธ Database Comparison ๐Ÿ“–

โšก Sorting Algorithm Complexity

Legend

  • ฮฉ (Omega) โ†’ Best case
  • ฮ˜ (Theta) โ†’ Average case
  • O (Big O) โ†’ Worst case
  • Stable? โœ… Yes / โŒ No
# Algorithm โฑ๏ธ Best โš–๏ธ Average ๐Ÿ”ป Worst ๐Ÿ’พ Space โš™๏ธ Stability
1๏ธโƒฃ โšก Quick Sort ฮฉ(n log n) ฮ˜(n log n) O(nยฒ) O(log n) โŒ No
2๏ธโƒฃ ๐Ÿงฉ Merge Sort ฮฉ(n log n) ฮ˜(n log n) O(n log n) O(n) โœ… Yes
3๏ธโƒฃ ๐Ÿš€ Timsort ฮฉ(n) ฮ˜(n log n) O(n log n) O(n) โœ… Yes
4๏ธโƒฃ โ›ฐ๏ธ Heap Sort ฮฉ(n log n) ฮ˜(n log n) O(n log n) O(1) โŒ No
5๏ธโƒฃ ๐Ÿ’ง Bubble Sort ฮฉ(n) ฮ˜(nยฒ) O(nยฒ) O(1) โœ… Yes
6๏ธโƒฃ โœ๏ธ Insertion Sort ฮฉ(n) ฮ˜(nยฒ) O(nยฒ) O(1) โœ… Yes
7๏ธโƒฃ ๐Ÿชž Selection Sort ฮฉ(nยฒ) ฮ˜(nยฒ) O(nยฒ) O(1) โŒ No
8๏ธโƒฃ ๐ŸŒฒ Tree Sort ฮฉ(n log n) ฮ˜(n log n) O(nยฒ) O(n) โœ… Yes
9๏ธโƒฃ ๐Ÿš Shell Sort ฮฉ(n log n) ฮ˜(n (log n)ยฒ) O(n (log n)ยฒ) O(1) โŒ No
๐Ÿ”Ÿ ๐Ÿชฃ Bucket Sort ฮฉ(n + k) ฮ˜(n + k) O(nยฒ) O(n) โœ… Yes
1๏ธโƒฃ1๏ธโƒฃ ๐Ÿ”ข Radix Sort ฮฉ(n k) ฮ˜(n k) O(n k) O(n + k) โœ… Yes
1๏ธโƒฃ2๏ธโƒฃ ๐Ÿงฎ Counting Sort ฮฉ(n + k) ฮ˜(n + k) O(n + k) O(k) โœ… Yes
1๏ธโƒฃ3๏ธโƒฃ ๐ŸงŠ Cube Sort ฮฉ(n) ฮ˜(n log n) O(n log n) O(n) โœ… Yes


Related Posts

  • ๐Ÿงฑ Data Structures & Big O Complexity โ€” the Big O/Big Omega/Big Theta notation used throughout this comparison
  • ๐Ÿ”Ž Searching Algorithm Complexity โ€” Binary Search and other sorted-data-dependent searches this sorting step enables
Hitesh Sahu
Written by Hitesh Sahu, a passionate developer and blogger.

Fri Feb 20 2026

Share This on

โ† Previous

๐Ÿ”Ž Searching Algorithm Complexity ๐Ÿ“–

Next โ†’

๐Ÿ—„๏ธ Database Comparison ๐Ÿ“–

Programming/6-Sorting
Let's work together
+49 176-2019-2523
hiteshkrsahu@gmail.com
WhatsApp
Skype
Munich ๐Ÿฅจ, Germany ๐Ÿ‡ฉ๐Ÿ‡ช, EU
Playstore
Hitesh Sahu's apps on Google Play Store
Need Help?
Let's Connect
Navigation
ย  Home/About
ย  Skills
ย  Work/Projects
ย  Lab/Experiments
ย  Contribution
ย  Awards
ย  Art/Sketches
ย  Thoughts
ย  Contact
Links
ย  Sitemap
ย  Legal Notice
ย  Privacy Policy

Made with

NextJS logo

NextJS by

hitesh Sahu

| ยฉ 2026 All rights reserved.