Question 1 of 5
Sorted miles [3,6,9,12,15,18,21]. Search 6; first middle index 4 (value 12). (a) Remaining values? (b) Comparisons so far? (c) Could 21 still be the target location?
Responses receive AI feedback against a rubric after submission. Scores are practice estimates.
Sorted miles [3,6,9,12,15,18,21]. Search 6; first middle index 4 (value 12). (a) Remaining values? (b) Comparisons so far? (c) Could 21 still be the target location?
messy=[14,2,9,11]; neat=[2,9,11,14] (a) Which should not use binary search? (b) For neat, first middle 11 seeking 2: remaining? (c) Meaning of sorted for these numbers?
Sorted codes [5,7,9,11,13,15]. Target 13; first compare 9 (index 3). (a) Remaining candidates? (b) Next compare 13: total comparisons to find it? (c) Left-to-right scan checking 5,7,9,11,13: comparisons to find 13?
Sorted [1,4,9,16,25] seek 8; first middle 9. (a) Remaining after comparing 9? (b) Next compare 4 on remaining [1,4]. Is 8 present? (c) Conclusion when remaining range is empty?
Inventory:
| Shelf | Contents | Ordered low to high? |
|---|---|---|
| North | 1, 4, 8, 8, 10 | yes |
| South | 10, 8, 4, 1 | no |
(a) Which shelf is appropriate for binary search? (b) On that shelf, search 8; first middle index 3 (value 8). Conclusion? (c) Why duplicates do not forbid binary search on North?