Programming assignment 3.
Implement a function called Quick_select to find the kth least element on a given array. (The average running time of your algorithm should be O(n))
- Request the user to enter a positive integer, and call it n.
- Generate n random integers between -100 to 100 and save them in array a.
- Print the generated array.
- Request the user to enter a number between 1 to n (k least element).
- Call your Quick_select function to find and print the kth least element.
Modify your algorithm to return the max k numbers from an unsorted array. (The average running time of your algorithm should be O(n))
(Example: a = [4 2 0 10 1 6], k = 3 ➔ Output = [4 10 6])