Recursive Searching and Sorting (Binary Search, Merge Sort)

AP Computer Science A· difficulty 4/5

Binary search requires that the array

  • A

    Contain unique values only

  • B

    Use primitive int values, not Integer objects

  • C

    Have an even number of elements

  • D

    Be sorted in the order being searched

    check_circle

Explanation

Binary search relies on the monotonic ordering invariant. Without sortedness, it cannot prune halves correctly.

Want 10 more like this — adaptive to your weak spots?

Related questions