Recursive Searching and Sorting (Binary Search, Merge Sort)

AP Computer Science A· difficulty 4/5

Binary search algorithm pseudocode:

  • A

    Linear scan

  • B

    low=0, high=n-1; while low<=high: mid=(low+high)/2; if (arr[mid]==target) return mid; else if (target<arr[mid]) high=mid-1; else low=mid+1; return -1;

    check_circle
  • C

    Hash table

  • D

    Tree traversal

Explanation

Standard iterative binary search.

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

Related questions