Question
C) Consider the following extension to Binary Search a sorted list A for an item x: Lets call it UnevenBinSearch. Let qp be the partitioning
C) Consider the following extension to Binary Search a sorted list A for an item x: Lets call it UnevenBinSearch. Let qp be the partitioning element of A so that A is divided into two lists, left sublist is close to length [n/4] and the right sublist is of length n-[n/4]~[3n/4] (i.e., a difference of 1, 2 or 3 is allowed between the sizes of these sublists but no more). Based on qp, decide the sublist where x may exist. Repeat this process until the sublist is small enough that the answer can be directly obtained. 5.1. Write pseudo-code for the above UnevenBinSearch method, specifying all the parameters correctly. 5.2. Derive the recurrence relation for the running time of the UnevenBinSearch algorithm. 5.3. Solve the recurrence relation, find a close-bound for the running time of UnevenBinSearch and then express this close-bound using asymptotic notation. Justify your answer. 5.4. Derive an expression and its asymptotic bound for the space complexity of UnevenBinSearch. 5.5. Repeat steps 5.1-5.4 if the partitioning element qp happens to divide the list so that the left sublist is of size [3n/4] and the right sublist is of length n-[3n/4].
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started