Implement a function to find the ** K **elements of a given array that are

__closet to the median__. (

**: You could modify Quick_Select to find the answer!)**

__Hint__- Request the user to enter a positive integer, and call it
.*n* - Generate
random integers between*n*to__-100__and save them in__100__.*a* - Print the generated array.
- Request the user to enter a number between 1 to n, and call it
.*K* - Find the median of the array. (
__Hint__can you use quick select? What is the time complexity in this step?)__:__ - Save the differences from the median (|a[i]-median|) in a new array and call it
. (*diff*: The__Note__closet elements/numbers have the K smallest difference from the median. What is the time complexity in this stage?)*K* - Use
to find the K numbers. (*diff*__Hint__can you use quick select again? What is the time complexity in this step?)__:__ - Shift the found K numbers back to their original value (+median). (
: What is the time complexity in this step?)__Question__ - Print the answer 😊
- Calculate the total time complexity of your algorithm and present your answer when demoing.

## Reviews

There are no reviews yet.