What will be the maximum number of comparisons that can be made in jump search algorithm (assuming k to be blocks jumped)?

Quốc Ân

New member
What will be the maximum number of comparisons that can be made in jump search algorithm (assuming k to be blocks jumped)?
A. k
B. n/k
C. k-1
D. k-1
 
Answer: c
Explanation: Worst case occurs when the element being searched is present just after the element that has been compared while making the last jump. So, in this case k-1 comparisons will have to be made.
 

Tìm kiếm

Back
Top