Engineering Questions with Answers - Multiple Choice Questions

Home » MCQs » Aeronautical Engineering » Bucket Sort (Uniform Keys) Multiple Choice MCQ

# Bucket Sort (Uniform Keys) Multiple Choice MCQ

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**

Answer: d

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.

What is the alternate name of bucket sort?

a) group sort

b) radix sort

c) bin sort

d) uniform sort

**
View Answer**

Answer: c

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

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**

Answer: c

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

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**

Answer: d

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.

Which of the following don’t affect the time complexity of bucket sort?

a) algorithm implemented for sorting individual buckets

b) number of buckets used

c) distribution of input

d) input values

**
View Answer**

Answer: d

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. It doesnot depend on the input value. It can be either positive or negative or zero.

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**

Answer: b

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.

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**

Answer: b

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

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**

Answer: c

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.

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**

Answer: a

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.

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**

Answer: a

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.

Bucket sort is an in place sorting algorithm.

a) True

b) False

**
View Answer**

Answer: b

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

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**

Answer: b

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