**0 to 1000000 integers: **since it is of a large set, quicksort will be efficient

**0 to 100 integers: **radix sort will be efficient

The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

0 votes

**To sort the following numbers which algorithm will suit the best **

**(i) 1 to 100 integers (ii) 0 to 1000000 integers **

** a)bucket sort for both **

**b) (i)radix sort (ii)quick sort **

**c) (i)quick sort (ii)merge sort **

** d) (i) merge sort (ii)quick sort**

+1 vote

Best answer

radix sorts time complexity is n (logn base b ) here base is 10 and if we convert 100 as 10^2 we get O(2*n) for radix sort hence efficient compared to others for integers from 0 to 100 and in second case quick sort is best as it doesnt speak anything about the input and it only speaks about the range the input can be in any order generally quicksort is considered "quick" in implementation as id doesnt use any auxilary arrays and is inplace and it has no copying time like that of merge and the worst case can be avoided with randomised version of it hence 1. radix 2.quick sort

- All categories
- General Aptitude 1.4k
- Engineering Mathematics 5.9k
- Digital Logic 2.3k
- Programming & DS 4.2k
- Algorithms 3.7k
- Theory of Computation 4.6k
- Compiler Design 1.7k
- Databases 3.4k
- CO & Architecture 2.9k
- Computer Networks 3.3k
- Non GATE 1.2k
- Others 1.3k
- Admissions 506
- Exam Queries 482
- Tier 1 Placement Questions 22
- Job Queries 64
- Projects 15

40,861 questions

47,532 answers

145,984 comments

62,293 users