Question: Please explain your process. 1. Given a sorted array of n comparable items A, and a search value key, return the position (array index) of

Please explain your process.

Please explain your process. 1. Given a sorted array of n comparable

1. Given a sorted array of n comparable items A, and a search value key, return the position (array index) of key in A if it is present, or -1 if it is not present. If key is present in A, your algorithm must run in order O(log k) time, where k is the location of key in A. Otherwise, if key is not present, your algorithm must run in O(log n) time. Turn in: a. A written description of your algorithm, along with an explanation for why it works, and an analysis of your run time. b. A C++ implementation of your solution. Use: int fastFind(vector &A, double key);' as your function prototype

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 Databases Questions!