What type of search does the following function implement?bool aSearch (int list[ ], int last, int target, int* locn ){ int begin, mid, end; begin = 0; end = last; while (begin <= end) { mid = ( begin + end ) / 2; if ( target > list[ mid ] ) begin = mid + 1; else if ( target < list[ mid ] ) end = mid - 1; else begin = end + 1; } *locn = mid; return (target == list [mid]);}
A. sequential search
B. probability search
C. ordered list search
D. binary search
Answer: D
Computer Science & Information Technology
You might also like to view...
The .class extension on a file means that the file:
a. Contains java source code b. Contains HTML c. is produced by the Java compiler (javac). d. None of the above.
Computer Science & Information Technology
A(n) ____________________ list is a list of terms, each followed by a description line.
Fill in the blank(s) with the appropriate word(s).
Computer Science & Information Technology
The ________ button provides formatting choices for text that has been newly inserted into a document
A) Formatting B) Text C) Paste Options D) Options
Computer Science & Information Technology
________ scenarios can be created within Scenario Manager
Fill in the blank(s) with correct word
Computer Science & Information Technology