Question: Given an array of size n, where n = (2^k) 1 for some k1,2,3...., 1.let fn(k) be the number of elements of the array which
Given an array of size n, where n = (2^k) 1 for some k1,2,3....,
1.let fn(k) be the number of elements of the array which require exactly k calls to binary search before they are found. Derive a formula for fn(k).
2. What is the average case time complexity of binary search? Assume that the target is in the array exactly once and that the probability of it being in any given position is simply 1/n. shuffled randomly before the first call.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
