Given the following array definition
Dim intCalories() As Integer = {35, 45, 75, 110, 145, 160, 195, 405, 435}
outline the steps for the BinarySearch method's efforts to find the value 405.
What will be an ideal response?
The steps for the BinarySearch method are: 1. Determine the halfway point of the array, which is the number 145. Compare that value first: 145 is less than 405.2. If the first comparison is not equal to the number being searched, determine whether the value of the search number is less than the middle value. If the search value is less, narrow the search interval to the lower half. Otherwise narrow the search to the upper half of the array. The search value 405 is greater than the middle value 145, so the process narrows the search to the upper half of the array, which contains 160, 195, 405, and 435.3. Repeatedly check each interval until the value is found or until the halving process evaluates the entire element list of the array.
You might also like to view...
Totals are often used as the data series, which determines the size of each pie ________
Fill in the blank(s) with correct word
When you add ActiveX controls to your worksheet, you are working in which of the following modes?
A) Active Mode B) Insert Mode C) View Mode D) Design Mode