is a sorted array of distinct integers, and a recursive binary search looks for ; each step makes one comparison of the middle element with (equal, less or greater). The maximum number of comparisons if is not in is .
Source: GATE DA
Programming · Hard · Searching, Sorting & Complexity · Problem 1
is a sorted array of distinct integers, and a recursive binary search looks for ; each step makes one comparison of the middle element with (equal, less or greater). The maximum number of comparisons if is not in is .
Source: GATE DA
Free. Sign in with Google to read Srijit's solutions and talk the problems through with everyone in the cohort.