Trace table for a binary search

An ascending list holds the values 6, 11, 18, 24, 30, 37, 45, 51, 59, 64, 72 at indices 0 through 10. A binary search looks for the value 24, computing mid as the floor of (low + high)/2 and moving low to mid + 1 or high to mid - 1 after each comparison. Complete the table with the values of low and high at the start of each iteration, the mid index, and the value stored at mid. The search finds the target in the third iteration.

IterationlowhighmidValue at mid
1
2
3

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Binary Search Questions: