Question: Can someone help me explain and implement this questions algorithm as to better understand about the situation ? how to achieve this ? this is

Can someone help me explain and implement this questions algorithm as to better understand about the situation ? how to achieve this ? this is going to be for Java as that is where i am having trouble implementing in general. please let me know

Write a function that gets an array TESTER of length n of integers, and 0kn, and returns an array Check of length k containing the smallest k elements in TESTER. In the end TESTER must be in the same state as in the beginning. The running time must be O(n log(k)) and extra space used should be O(k). For example, on input TESTER =[4,1,5,7,2,3,1,3] and k=4 the output should be Check = [1,1,2,3].

The order of the elements in Check is not important

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!