RadixSort

The lower bound for Comparison based sorting algorithm (Merge Sort, Heap Sort, Quick-Sort .. etc) is Ω(nLogn), i.e., they cannot do better than nLogn.

Counting sort is a linear time sorting algorithm that sort in O(n+k) time when elements are … More on Radix Sort
 

1
Question 1
Given an array where numbers are in range from 1 to n6, which sorting algorithm can be used to sort these number in linear time?
A
Not possible to sort in linear time
B
Radix Sort
C
Counting Sort
D
Quick Sort
Sorting    QuickSort    RadixSort    CountingSort    
Discuss it


Question 1 Explanation: 
See Radix Sort for explanation.
Question 2
If we use Radix Sort to sort n integers in the range (nk/2,nk], for some k>0 which is independent of n, the time taken would be?
A
Θ(n)
B
Θ(kn)
C
Θ(nlogn)
D
Θ(n2)
Analysis of Algorithms    Sorting    RadixSort    Gate IT 2008    
Discuss it


Question 2 Explanation: 
Radix sort time complexity = O(wn)
for n keys of word size= w
=>w = log(nk)
O(wn)=O(klogn.n)
=> kO(nlogn)
Question 3
If there are n integers to sort, each integer has d digits, and each digit is in the set {1, 2, ..., k}, radix sort can sort the numbers in:
A
O (k (n + d))
B
O (d (n + k))
C
O ((n + k) lg d)
D
O ((n + d) lg k)
RadixSort    UGC NET CS 2016 Aug - III    
Discuss it


Question 3 Explanation: 
If there are n integers to sort, each integer has d digits, and each digit is in the set {1, 2, ..., k}, radix sort can sort the numbers in O(d (n + k)). For more information Refer:Radix Sort Option (B) is correct.
Question 4
If there are n integers to sort, each integer has d digits and each digit is in the set {1, 2, ..., k}, radix sort can sort the numbers in :
A
O(d n k)
B
O(d nk)
C
O((d +n) k)
D
O(d (n + k))
RadixSort    UGC NET CS 2015 Dec – III    
Discuss it


Question 5
The maximum number of comparisons needed to sort 9 items using radix sort is (assume each item is 5 digit octal number):
A
45
B
72
C
360
D
450
RadixSort    UGC NET CS 2018 July - II    
Discuss it


There are 5 questions to complete.
1

 

Coding practice for sorting.

 



My Personal Notes arrow_drop_up


Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.