Completar Frases

Algorithm for binary searchVersión en línea

Fill in the blanks for an algorithm for a binary search

por James
1

midpoint change range greater focus Initially searching middle empty ordered item

Take an list of data and an that is being searched for ?
Maintain a of items where the search item might be found . ?
, set the range to be the entire list . ?
Repeat steps a - e until you find the item you are for or there are no more items to check ( the range is ) : ?
Find the item in the of the range ( the item ) . ?
Compare the midpoint item to the item you are searching for . ?
If the midpoint item is equal to the search item , then stop searching . ?
Otherwise , if the midpoint item is less than than the search item , the range to focus on the items after the midpoint . ?
Otherwise , if the midpoint item is than than the search item , change the range to on the items before the midpoint . ?