Recursive Searching and Sorting (Binary Search, Merge Sort)

AP Computer Science A· difficulty 2/5

int[] a = {5, 2, 8, 1, 9};
// attempt binary search on a

Why might binary search fail on this array?

  • A

    Binary search needs even length

  • B

    The array is too small

  • C

    The array is not sorted

    check_circle
  • D

    Arrays must be Strings

Explanation

Binary search requires the array to be sorted; this array is not.

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

Related questions