Question: Given an input parameter n, Alice has an unsorted array A of n n items, and she needs to perform O(log n) search operations on

Given an input parameter n, Alice has an unsorted array A of n n items, and she needs to perform O(log n) search operations on A. She has two algorithms in mind to achieve this:

Algorithm 1: Sort A using MERGE SORT and then perform all of O(log n) search operations using binary search.

Algorithm 2: Perform all of O(log n) search operations directly on A using linear search.

Present the running times of each of the two algorithms separately, and select the algorithm you would suggest to Alice by determining which one is asymptotically faster

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!