Question: In java write code to find the k th largest element in the array A by a deterministic Selection and print the 1 st ,

In java write code to find the kth largest element in the array A by a deterministic Selection and print the 1st, 3rd, 5th, 10th, 13th, 15th largest elements. Here is the pseduo-code I need it turned into real code:

Select(A,i,n)

1 if (n = 1) 2 then return A 3 Split the items into bn/5c groups 5 (and one more group). Call these groups G1,G2,...,Gbn/5c 4 Find the median mi of each Gi 5 Recursively compute the median of medians, p = Select({m1,...,mbn/5c},bn/10c,bn/5c) 6 L = {x A : x p} H = {x A : x > p} 7 if i |L| 8 then Select(L,i,|L|) 9 else Select(H,i|L|,|H|)

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!