PadhaikoAll subjects

Past exam question: 2063 Baishakh (Regular / Back), Q8

Data Structure and Algorithms · 8 marks

Open in the Padhaiko app

Topic: Sorting Algorithms

Question

Explain the basic principle of radix sort. Trace the sorting steps in quick sort and radix sort. 25,57,48,37,12,92,86,33

Solution

Basic Principle of Radix Sort: Radix sort sorts keys without element-to-element comparisons by grouping them stably digit-by-digit into buckets (0..9) starting from the Least Significant Digit (LSD) up to the Most Significant Digit (MSD).

1. Quick Sort Trace on [25, 57, 48, 37, 12, 92, 86, 33] (First-Element Pivot):

2. Radix Sort Trace on [25, 57, 48, 37, 12, 92, 86, 33]:

Answer:

Both quick sort and radix sort produce the sorted sequence: 12, 25, 33, 37, 48, 57, 86, 92.

All past exam questions for Data Structure and Algorithms