Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1low ← 1 | ACalculates the middle index of the range | |
| 2mid ← (low + high) DIV 2 | BSets the starting point of the search range | |
| 3Repeatedly halves the search range | CWrong - the array must be sorted first | |
| 4Compares the middle element to the target | DWHILE low <= high | |
| 5Binary search checks every element | EWrong - it skips half the elements each time | |
| 6Binary search works on unsorted arrays | FIF numbers[mid] = target THEN |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
Binary Search — An algorithm that repeatedly halves a sorted array to quickly find a target value.mid ← (low + high) DIV 2WHILE low <= highWHILE low <= highIF numbers[mid] = target THENDISPLAY "Found at position", mid