This set of Data Structures & Algorithms Multiple Choice Questions & Answers (MCQs) focuses on “Bucket Sort (Uniform Keys)”.

1. How many comparisons will be made to sort the array arr={1, 5, 3, 8, 2} using bucket sort?

a) 5

b) 7

c) 9

d) 0

View Answer

Explanation: As bucket sort is an example of a non-comparison sort so it is able to sort an array without making any comparison. So the answer should be 0.

2. What is the alternate name of bucket sort?

a) group sort

b) radix sort

c) bin sort

d) uniform sort

View Answer

Explanation: Bucket sort is also known as bin sort. It is an example of a non-comparison sort.

3. Which of the following non-comparison sort can also be considered as a comparison based sort?

a) counting sort

b) MSD radix sot

c) bucket sort

d) pigeonhole sort

View Answer

Explanation: Bucket sort can also be considered as a comparison based sort. It is because it can also be implemented with comparisons.

4. Which of the following is not true about bucket sort?

a) It is a non comparison based integer sort

b) It is a distribution sort

c) It can also be considered as comparison based sort

d) It is in place sorting algorithm

View Answer

Explanation: Bucket sort is a non comparison based integer sort. It sorts the given data by distributing the array elements into a number of buckets. It is not an in place sorting technique.

5. Which of the following affect the time complexity of bucket sort?

a) algorithm implemented for sorting individual buckets

b) number of buckets used

c) distribution of input

d) all of the mentioned

View Answer

Explanation: Time complexity of bucket sort is affected by various factors. These include algorithm implemented for sorting individual buckets, number of buckets used and distribution of input.

6. Bucket sort is most efficient in the case when __________

a) the input is non uniformly distributed

b) the input is uniformly distributed

c) the input is randomly distributed

d) the input range is large

View Answer

Explanation: Bucket sort works by distributing the array elements into a number of buckets. So bucket sort is most efficient in the case when the input is uniformly distributed.

7. Bucket sort is a generalization of which of the following sort?

a) LSD radix sort

b) Pigeonhole sort

c) Counting sort

d) MSD radix sort

View Answer

Explanation: Pigeonhole sort is a particular case of bucket sort. Bucket sort is also closely related to MSD radix sort.

8. What is the worst case time complexity of bucket sort (k = number of buckets)?

a) O(n + k)

b) O(n.k)

c) O(n^{2})

d) O(n log n)

View Answer

Explanation: Time complexity of bucket sort is O(n

^{2}) in the worst case. So if bucket sort does not get the inputs in the desired manner then it becomes very inefficient.

9. What is the best time complexity of bucket sort (k= number of buckets)?

a) O(n + k)

b) O(n.k)

c) O(n^{2})

d) O(n log n)

View Answer

Explanation: Time complexity of bucket sort is O(n+k). It performs better than any comparison based sort if there is a uniform input distribution.

10. Which of the following is not necessarily a stable sorting algorithm?

a) bucket sort

b) counting sort

c) merge sort

d) pigeonhole sort

View Answer

Explanation: Bucket sort is not necessarily a stable sorting algorithm. This is because its stability depends on the stability of the algorithm that we have used to sort the individual buckets.

11. Bucket sort is an in place sorting algorithm.

a) True

b) False

View Answer

Explanation: Bucket sort is not an in place sorting algorithm. It requires an auxiliary space of O(n k) in the worst case.

12. What is the worst space complexity of bucket sort (k = number of buckets)?

a) O(n + k)

b) O(n.k)

c) O(n^{2})

d) O(n log n)

View Answer

Explanation: Worst case space complexity of bucket sort is O(n.k). So it is not an in place sorting algorithm.

**Sanfoundry Global Education & Learning Series – Data Structures & Algorithms.**

To practice all areas of Data Structures & Algorithms, __here is complete set of 1000+ Multiple Choice Questions and Answers__.