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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started