Counting Sort Multiple choice Questions and Answers (MCQs)

 

 Buy/Download all MCQ Ebook   >>>Click Here<<<

Counting Sort Multiple choice Questions and Answers (MCQs)

Click on any option to know the CORRECT ANSWERS

Question 1
How many comparisons will be made to sort the array arr={1, 5, 3, 8, 2} using counting sort?
A
5
B
7
C
9
D
0
Management Questions answers

Question 1 Explanation: 
As counting sort is an example of non comparison sort so it is able to sort an array without making any comparison.

Question 2
Which of the following is not an example of non comparison sort?
A
bubble sort
B
counting sort
C
radix sort
D
bucket sort
GK Questions answers

Question 2 Explanation: 
Bubble sort is not an example of non comparison sort as it needs to compare array elements in order to sort an array.

Question 3
Which of the following sorting techniques is most efficient if the range of input data is not significantly greater than a number of elements to be sorted?
A
selection sort
B
bubble sort
C
counting sort
D
insertion sort
KBC Questions answers

Question 3 Explanation: 
Time complexity of counting sort is given as O(n+k) where n is the number of input elements and k is the range of input. So if range of input is not significantly larger than number of elements in the array then it proves to be very efficient.

Question 4
What is the auxiliary space requirement of counting sort?
A
O(1)
B
O(n)
C
O(log n)
D
O(n+k) k=range of input
KBC Questions answers

Question 4 Explanation: 
Counting sort uses two extra arrays to get the input array sorted. First array is required to store the count of all the elements which fall in the range of input data elements, so its size is k. The second array is required to store the input elements in sorted manner, so its size is n. Thus overall auxiliary space required becomes O(n+k).

Question 5
It is not possible to implement counting sort when any of the input element has negative value.
A
True
B
False
Sociology Questions answers

Question 5 Explanation: 
It is possible to extend the counting sort algorithm for negative numbers as well. In such a case we store the minimum element at the 0th index.

There are 5 questions to complete.

 

 Buy/Download all MCQ Ebook >>>CLICK HERE<<<