In which of the following case jump search will be preferred over binary search?

Man Ly

New member
In which of the following case jump search will be preferred over binary search?
A. jumping backwards takes significantly more time than jumping forward
B. jumping forward takes significantly more time than jumping backwards
C. when the given array is very large in size
D. when the given array is very small in size
 
Answer: a
Explanation: Jump search only needs to jump backwards once, while a binary can jump backwards up to log n times. Thus jump search will be preferred over binary search if jumping backwards is expensive.
 

Tìm kiếm

Back
Top