Give the recursive binary search algorithm.
What will be an ideal response?
The recursive binary search is sent an array and indices first and last that specify limits of the subarray. The function tests the condition first>last to determine whether the key is not present in the array. If true, report this and quit.
If the key may be present, a ‘middle’ index is computed, and the equality of the element at the middle is compared to the key. If equal, report this fact and quit.
If the key still may be present, determine if the key is in the upper or lower half of the array and recursively call the search on that half array.
You might also like to view...
To use an Access file as a data source for a Word mail merge, you must first retype the Access data into the Word document so it can be used by the Mail Merge Wizard in Word.
a. true b. false
?Identify the correct hierarchy of tags to create a web table.
A. ?
, |
, |
, |