Question: CSC 2 0 4 - Algorithm Design and Analysis Homework 2 - Divide and Conquer and Solving Recurrences Name: Student Binary Search ( recursive )
CSC Algorithm Design and Analysis
Homework Divide and Conquer and Solving Recurrences
Name:
Student
Binary Search recursive points
Binary Search is an algorithm that takes as input a sorted array a specific value to search
for, and the start index and end index of the subarray to search in It begins by checking the
middle of the entire array A If the middle of the array contains the value being searched for
then the function returns the index. If the value in the middle of the array is not equal to the
value being searched for, then this process is repeated on either the left or the right subarray. If
the value is not found in the array, then the function should return In Homework # the
pseudocode for the iterative version of BinarySearch was given. Now we will explore the
recursive version
a Write pseudocode for the recursive function BinarySearch. You may NOT change the
function signature. points
BinarySearchA startindex, endindex
b Write down the recurrence equation for the worstcase running time of BinarySearch.
points
c Draw the recursion tree for the recurrence equation of the worst case of BinarySearch.
Include at least levels. points
d For an input of size how many levels are there in the recursion tree for the worse case?
points
e Based on your recursion tree, give an asymptotic tight bound for the worst case running
time of BinarySearch. points
f Based on the master theorem for solving recurrences, show how you end up with the same
running time as in part e State the values for and and show which case of the
master theorem you are using. points
Master Theorem Case #:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
