**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.3k
- Engineering Mathematics 5.1k
- Digital Logic 2k
- Programming & DS 3.7k
- Algorithms 3.1k
- Theory of Computation 3.9k
- Compiler Design 1.5k
- Databases 2.9k
- CO & Architecture 2.6k
- Computer Networks 2.9k
- Non GATE 1k
- Others 1.3k
- Admissions 456
- Exam Queries 428
- Tier 1 Placement Questions 17
- Job Queries 55
- Projects 8

35,535 questions

42,875 answers

121,904 comments

42,216 users