Question: Suppose you are given the following inputs: a sorted array A , containing n distinct integers, a lower bound l , and an upper bound

Suppose you are given the following inputs: a sorted array A, containing n distinct
integers, a lower bound l, and an upper bound u, where l and u might not be in the array A.
Design a divide & conquer algorithm in O(log n) to find the number of elements in A between l
and u, inclusive. Make sure to justify the algorithms correctness and the time complexity (using
Masters Theorem).
(a.) Describe your algorithm in plain english.
Solution: [Write your answer here]
(b.) Argue that your algorithm correctly transforms the input to the correct outputs.
Solution: [Write your answer here]
(c.) Give the runtime of your algorithm and explain the reasoning.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!