Question: Please implement in PYTHON Please comment every step. Implement badStoogeSort from pseudocode to sort an array of integers. The value of should be an input

Please implement in PYTHON

Please comment every step.

Please implement in PYTHON Please comment every step. Implement badStoogeSort from pseudocode

Implement badStoogeSort from pseudocode to sort an array of integers. The value of should be an input parameter to your program. Implement the algorithm in PYTHON. Your program should be able to read inputs from a file called data.txt, where the first value of each line is the number of integers that need to be sorted, followed by the integers. The output will be written to a file called bad.out. Then, Modify the code to collect running time data. Call the new timing program badStoogeSort. Instead of reading arrays from the file data.txt and sorting, you will now generate arrays of size n containing random integer values from 0 to 10,000 to sort. Use the system clock to record the running times of each algorithm for n = 5000, 10000, 15000, 20,000, .... for two values of = 2/3 and = 3/4. You may need to modify the values of n if an algorithm runs too fast or too slow

Consider the following pseudocode for a sorting algorithm, for 0 1. badSort(A[O...n - 1]) if (n = 2) and (A[0] > A[1]) swap A[0] and A[1] else if (n > 2) m = fa.nl badSort(A[O...m 1]) badSort(A[n m...n 1]) badSort(A[O...m 1])

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!