Chapter quiz · Searching

Test what you learned.

8 questions on Searching. Pass 70% to clear the chapter.

← Review chapter lessons

Quiz

Searching — Chapter Quiz

Eight questions on binary search invariants, midpoint calculation, binary-on-answer, exponential search, and rotated-array search.

0/ 9
  1. Question 1
    1

    Why is mid = Math.floor((lo + hi) / 2) potentially unsafe in languages with fixed-size integers, and what is the safe alternative?

  2. Question 2
    2

    Binary search on a sorted array has a time complexity of:

  3. Question 3
    3

    The 'binary search on the answer' pattern is applicable when:

  4. Question 4
    4

    How do you find the pivot index in a sorted-then-rotated array during binary search?

  5. Question 5
    5

    Exponential search is especially useful when:

  6. Question 6
    6

    Standard binary search requires the search space to be sorted (or at least monotone with respect to the predicate being tested).

  7. Question 7
    7

    To find the leftmost position at which a value target can be inserted in a sorted array to keep it sorted, you can use a variant of binary search called ___ bound.

  8. Question 8
    8

    Which of the following are real-world applications of binary search? (Select all that apply)

    Select all that apply.

Pick an answer — instant feedback as you go.