Starting from:

$30

Programming assignment 2.

Programming assignment 2.

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.
Create two functions named quick_sort(a) and insertion_sort(a).
1. Request the user to enter a positive integer, and call it n.
2. Generate n random integers between -7000 to 7000 and save them in array a.
3. Call quick_sort(a) function to sort the array.
4. Call insertion_sort(a) function to sort the array.
5. Determine the average-running time of each function for n=10000, and 100 repetitions.
6. Calculate the growth of each function. (On a scratch paper!)
7. Calculate how many instructions your machine can run in a second using step 5 and 6(using the
running time of insertion sort).
 

More products