Starting from:

$30

Programming assignment 3.

Programming assignment 3.

Remember:
You can remove all the variables from the workspace by writing “clear”
Look up the description of all the functions in MATLAB by typing doc in the command window.
Write a function to find the k
th least element on a given array with a running time of O(n).
(Hint: Use partitioning algorithm)
1. Request the user to enter a positive integer, and call it n.
2. Generate n random integers between -100 to 100 and save them in array a. (You can use randi function
in MATLAB)
3. Print the generated array.
4. Request the user to enter a number between 1 to n (as the kth least element).
5. Call your implemented function to find and print the kth least element.

More products