Skip to content
ExamHope Logo

examhope

Primary Menu
  • Digital Logic
    • Arithmetic Operations
    • Asynchronous/Ripple Counters
    • Basic Gates
    • Boolean Algebraic Theorems
    • Codes
  • Data Structures
    • Binary Heaps
    • Binary Search
    • Binary Search Trees
    • Binary Tree
    • Binary Tree Sort
    • Bipartite Graphs
    • Complete Graph
  • Theory of Computation
    • Finite Automata
    • Finite Automaton First Example
  • Current Affairs
    • Sports News
    • Tech News
    • Bollywood News
    • Daily News
  • Database
  • Computer Network
  • Computer Organization and Architecture
  • C Language
  • Operating Systems
  • Software Engineering
  • Theory of Computation
  • About us
  • Contact Us
  • Privacy Policy
  • DMCA Policy
  • Terms and Conditions
  • Home
  • IT
  • Data Structures
  • Radix Sort — Sorting
  • Radix Sort
  • Data Structures

Radix Sort — Sorting

examhopeinfo@gmail.com November 12, 2025 2 minutes read
Radix Sort

Radix Sort

🌱 What Is Radix Sort?

Radix Sort is a non-comparative sorting algorithm — meaning it doesn’t compare numbers directly.
Instead, it sorts numbers digit by digit, starting from either the least significant digit (LSD) or the most significant digit (MSD).

Think of it like sorting a list of phone numbers:
You could first arrange them by the last digit, then by the second-last, and so on — until the whole list is perfectly ordered.


🧩 How Radix Sort Works (Step-by-Step)

Let’s understand this with an example:
We’ll sort [170, 45, 75, 90, 802, 24, 2, 66] in ascending order using LSD (Least Significant Digit) method.


Step 1: Sort by the rightmost digit (units place)

We group numbers according to their last digit:

DigitNumbers
0170, 90
2802, 2
424
545, 75
666
8–
9–

After rearranging:
[170, 90, 802, 2, 24, 45, 75, 66]


Step 2: Sort by the next digit (tens place)

Now we look at the second digit from the right:

DigitNumbers
0802, 2
224
445
666
775
990
7170

After rearranging:
[802, 2, 24, 45, 66, 75, 90, 170]


Step 3: Sort by the leftmost digit (hundreds place)

Now we sort based on the hundreds digit:

DigitNumbers
02, 24, 45, 66, 75, 90
1170
8802

Final sorted list:
[2, 24, 45, 66, 75, 90, 170, 802]


📊 Diagram of Radix Sort

Initial List: [170, 45, 75, 90, 802, 24, 2, 66]

Pass 1 (On units digit):   [170, 90, 802, 2, 24, 45, 75, 66]
Pass 2 (On tens digit):    [802, 2, 24, 45, 66, 75, 90, 170]
Pass 3 (On hundreds digit):[2, 24, 45, 66, 75, 90, 170, 802]

Each pass brings the list closer to being fully sorted.


🧠 Why It Works

Radix Sort relies on stable sorting — meaning if two numbers have the same digit in the current position, their order stays the same as before.
That’s why we often use another algorithm like Counting Sort inside Radix Sort to handle each digit group efficiently.


💡 Real-Life Analogy

Imagine sorting a box of letters addressed to different cities.
You could first group them by the last letter of the city name,
then by the second last letter, and continue until they’re all neatly arranged.
That’s pretty much what Radix Sort does — but with digits!


⚙️ Time Complexity

  • Best case: O(nk)
  • Average case: O(nk)
  • Worst case: O(nk)

Here,

  • n = number of elements,
  • k = number of digits in the largest number.

Radix Sort is very efficient when k is small compared to n.


🧾 Advantages

✅ Works great for large numbers or fixed-length integers.
✅ No comparisons needed between elements.
✅ Stable sorting (keeps order of equal elements).


⚠️ Disadvantages

❌ Needs extra space for temporary buckets or queues.
❌ Not suitable for data with very large digit counts or decimals.


About the Author

examhopeinfo@gmail.com

Administrator

Visit Website View All Posts

Post navigation

Previous: Shell Sort — Sorting
Next: Binary Search — Searching

Related News

Linked Representation
  • Linked Representation of a Graph
  • Data Structures

Linked Representation of a Graph

examhopeinfo@gmail.com November 14, 2025 0
Path Matrix
  • Path Matrix
  • Data Structures

Path Matrix

examhopeinfo@gmail.com November 14, 2025 0
Adjacency Matrix
  • Adjacency Matrix
  • Data Structures

Adjacency Matrix

examhopeinfo@gmail.com November 14, 2025 0

Recent Posts

  • Vivo X200: जाने कितनी कम कीमत पर मिल रहा ये 9400 मिडिया टेक प्रोसेसर वाला स्मार्टफोन
  • Samsung Galaxy S25 Plus पर मिल रही भारी छूट ,जाने सेल प्राइस
  • AI के इस ज़माने में कैसे बिजली बचा रहे हैं यह स्मार्ट प्लग?
  • क्या है यह GhostPairing Scam और बिना पासवर्ड और सिम के क्यों हो रहा है व्हाट्सप्प अकाउंट हैक
  • Leica कैमरे के साथ जल्द लॉन्च हो सकता है Xiaomi Ultra 17

At ExamHope, we understand that preparing for exams can be challenging, overwhelming, and sometimes stressful. That’s why we are dedicated to providing high-quality educational resources, tips, and guidance to help students and aspirants achieve their goals with confidence. Whether you are preparing for competitive exams, school tests, or professional certifications, ExamHope is here to make your learning journey smarter, easier, and more effective.

Quick links

  • About us
  • Contact Us
  • Privacy Policy
  • Terms and Conditions
  • Disclaimer
  • DMCA Policy

Category

  • Computer Network
  • Computer Organization and Architecture
  • Data Structures
  • C Language
  • Theory of Computation
  • Database

You may have missed

Vivo X200 Price Drop
  • IT
  • Current Affairs
  • Tech News

Vivo X200: जाने कितनी कम कीमत पर मिल रहा ये 9400 मिडिया टेक प्रोसेसर वाला स्मार्टफोन

examhopeinfo@gmail.com December 23, 2025 0
Samsung Galaxy S25 Plus
  • IT
  • Current Affairs
  • Tech News

Samsung Galaxy S25 Plus पर मिल रही भारी छूट ,जाने सेल प्राइस

examhopeinfo@gmail.com December 22, 2025 0
Electricity bill saving Smart Plug
  • IT
  • Current Affairs
  • Tech News

AI के इस ज़माने में कैसे बिजली बचा रहे हैं यह स्मार्ट प्लग?

examhopeinfo@gmail.com December 21, 2025 0
Ghost Pairing Scam on Whatsapp
  • IT
  • Current Affairs
  • Tech News

क्या है यह GhostPairing Scam और बिना पासवर्ड और सिम के क्यों हो रहा है व्हाट्सप्प अकाउंट हैक

examhopeinfo@gmail.com December 21, 2025 0
Copyright © All rights reserved for ExamHope. | MoreNews by AF themes.
Go to mobile version