am i right in saying that if a value cannot be determined in a binary search algorithm. i.e it is not in the list of values showing then there is no need to continue with the second pass or do u continue with the second pass and then the third pass and then determine no result
Copyright © 2024 Q2A.ES - All rights reserved.
Answers & Comments
Verified answer
You cannot skip the search if you do not find the item in first pass
example
array: 5,4,3,2,1
search item=5
1st pass
middle term=3
5!=3
so you have to continue because 5 is there but it is not found in 1st pass