Question: Exercise 1 Suppose that you have a black - box worst - case linear - time median subrou - tine, FindMedian. Give a simple, linear
Exercise Suppose that you have a blackbox worstcase lineartime median subrou tine, FindMedian. Give a simple, lineartime algorithm that find the kth order statistics for an array A of integers
Exercise Give an On algorithm that, given a array A of n distinct integers and a positive integer k n determines the k numbers in S that are closest to the median of A
Exercise Argue the correctness of BuildMaxHeap
BuildMaxHeapA n
: Aheapsize n
: forindowntodo : MaxHeapifyA i
by proving the following loop invariant: At the start of each iteration of the for loop of lines each node iin is the root of a maxheap
Exercise Give an On lg ktime algorithm to merge k sorted lists into one sorted list, where n is the total number of elements in all the input lists Hint: use a minheap for kway merging
Exercise Suppose in the algorithm SELECT median of medians the input elements are divided into groups of instead of to find the ith smallest element in a array A of size n Show that the worst case running time of this modified algorithm is defined by:
Tn Tn Tn n then use induction to show that Tn is On
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
