In the binary search routine in the text, the first thing the code does is to check whether the object is not in the array. What is the test for this condition?
a. first < last
b. first == last
c. first > last
d. the test does not involve the variables first and last.
c) On each recursive call, first is increased and last is decreased. When these pass each other, this condition is true, so there are no more index values to test.
Explanation: a) With arrays increasing sorted, while first < last, there are still a subarray where elements must be considered. b) when the first == last there is still one element that must be examined, so this also is the test for the target not being in the array. d) is nonsense.
You might also like to view...
The ________ identifies patterns and colors assigned to categories in the chart
A) data series B) legend C) data point D) chart sheet
What does the format command do?
What will be an ideal response?
?Packets that are smaller than a medium's minimum packet size are known by what term below?
A. jabbers B. ?giants C. ?ghosts D. ?runts
Ethernet/IP packet networks:
a. are supported with gigabit fiber optic networks in large cities b. are offered only by the common carriers c. use token ring layer 2 media access control d. use IPX/SPX protocols e. provide CIR up to a maximum of 1.544 Mbps