Page 1344 - AP Computer Science A, 7th edition
P. 1344

31. (A) If the list is sorted, a binary search is the most efficient algorithm to use. Binary search chops the current part of the array being examined in half, until you have found the element you are searching for, or there are no elements left to look at. In the worst case, you will need to divide by 2 seven times:
120/2 → 60 60/2 → 30 30/2 → 15 15/2 → 7 7/2 → 3 3/2 → 1 1/2 → 0

































































































   1342   1343   1344   1345   1346