At most, how many comparisons are required to search a sorted vector of 1023 elements using the binary search algorithm?
Answers
Answered by
2
Almost 10 ONLY if the array is sorted.
That is log(10) base two.
In case you want to calculate other values, the following link is a good website to do so.
Log base 2: log calculator
Base two is because binary search function throws away half the array each iteration.
That is log(10) base two.
In case you want to calculate other values, the following link is a good website to do so.
Log base 2: log calculator
Base two is because binary search function throws away half the array each iteration.
Similar questions