[SOLVED] CECS328-EC 2

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon EC2-jgttne.zip (135.7 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
πŸ”’ Securely Powered by:
Secure Checkout
Rate this product

Extra Credit 2.

 

 

Implement two functions named quick_sort and insertion_sort.Β 

Note: Please use median-of-three to find your pivot in your QuickSort.

  1. Request the user to enter a positive integer, and call it n. (n = 1000)
  2. Generate n random integers between -5000 to 5000 and save them in array a.
  3. Call quick_sort and insertion_sort functions to sort the array.
  4. Repeat steps 2 and 3 for 100 times to determine the average-running time of each function.
  5. Print the end/finish time for your function. (Note: to be more precise, the time to generate a random array in each iteration should be excluded from the result)
  6. Calculate the growth of each function. (On a scratch paper!)
  7. Write a code to calculate how many instructions your machine/laptop can run in a second using step 5 and 6 using the insertion_sort.

 

 

 

 

 

 

  • EC2-jgttne.zip