Question: 3. (6 points) Consider the following three algorithms to find the lowest k numbers out of an unsorted array of n numbers. Give the worst-case

 3. (6 points) Consider the following three algorithms to find the

3. (6 points) Consider the following three algorithms to find the lowest k numbers out of an unsorted array of n numbers. Give the worst-case order (big ) of each algorithm in terms of k and n. a. Keep a sorted array of the k lowest numbers. As you traverse the given array, if a number is lower than the k th lowest number you have, insert that number into the appropriate place in the array. b. Use merge sort to sort the given array, then just take the first k numbers. c. Create a min heap from the given array, then remove the mink times

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!