Comb Sort Multiple choice Questions and Answers (MCQs)

 

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

Comb Sort Multiple choice Questions and Answers (MCQs)

Click on any option to know the CORRECT ANSWERS

Question 1
Comb sort is an improved version of .....
A
Selection sort
B
Bubble sort
C
Insertion sort
D
Merge sort


Question 1 Explanation: 
Comb sort compares two elements at a variable gap from each other in each iteration unlike bubble sort where the gap remains 1. This reduces the average time complexity of comb sort.

Question 2
The gap between two elements being compared shrinks by a factor of ..... after every iteration.
A
1.1
B
1.2
C
1.3
D
1.4


Question 2 Explanation: 
It has been found experimentally that the gap between the two elements should shrink by a factor of 1.3 after each iteration for the most efficient sorting.

Question 3
The initial gap between two elements being compared .....
A
is equal to number of elements in the array
B
is equal to 1.3
C
depends on the number of iterations
D
depends on the compiler being used


Question 3 Explanation: 
Initial gap is taken to be equal to the number of elements in the array and shrinks by a factor of 1.3 in each iteration, initial gap is independent of the number of iterations and compiler being used.

Question 4
What is the worst case time complexity of comb sort?
A
O(n2)
B
O(n log n)
C
O(n)
D
O(n2/2a) (a=number of increment)


Question 4 Explanation: 
Worst case complexity is observed when the input array is reverse sorted. This is same as the worst case complexity of bubble sort.

Question 5
The gap value after 3 iterations in an array with 6 elements will be .....
A
4
B
3
C
2
D
1


Question 5 Explanation: 
Initially the gap value will be 6. For the first iteration, it will be 6/1.3=4 then 4/1.3=3 for second iteration and 3/1.3=2 for the third iteration.

There are 5 questions to complete.

 

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