0%
0 / 14 answered

Binary Search Practice Test

14 Questions
Question
1 / 14
Q1

A database stores sorted usernames array "adam", "bella", "carlos", "dina", "eli", "fatima", "gwen", "hugo", "ivan" and searches for target "fatima" using iterative binary search; midpoint is $\lfloor(\text{low}+\text{high})/2\rfloor$, comparing strings alphabetically. Steps: low=0, high=8, mid=4 ("eli") < "fatima" so low=5; next mid=$\lfloor(5+8)/2\rfloor$=6 ("gwen") > "fatima" so high=5; next mid=$\lfloor(5+5)/2\rfloor$=5 ("fatima") found. Refer to the array provided above. How many iterations are required to locate the target element using binary search?

Question Navigator