subject

Consider the following pseudocode for a sorting algorithm, for 0 < α < 1 and n > 1.
badsort( - 1])
if (n = 2) and (a[0] > a[1])
swap a[0] and a[1]
else if (n > 2)
m = [α . n]
badsort( – 1])
badsort(a[n – – 1])
badsort( – 1])
1. implement badstoogesort from pseudocode to sort an array of integers. the value of α should be an input parameter to your program.
2. implement the algorithm in c/c++. 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.
3. 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, 1, 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.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:50
Using least squares fitting, you are to fit the data sets to the following models and solve for the parameters ai , where i is the index of the parameter. the input/output data for the systems are linked in the bblearn site. for each of the systems use matlab to plot the supplied data vs. the model fit on one plot. include your code in the solutions. (a) linear fit "lineardata.mat" y=a1x^3 + a2x^2 + a3x + a4 (b) plant fit "plantdata.mat g(s) = a1/(s + a2)
Answers: 1
question
Computers and Technology, 23.06.2019 10:00
Hey i just logged on and one of the moderators deleted a bunch of my answers to questions, even though the answers were right and the people it doesn't make sense but if anyone wants to talk about anything just message me lol (this is super random lol)
Answers: 1
question
Computers and Technology, 23.06.2019 16:30
Which of the following is not an enhancement to the standard wiki to make it more attractive for corporations? encryptionwork spacespermission toolspredictive text
Answers: 2
question
Computers and Technology, 23.06.2019 17:20
What is the best assassins creed game?
Answers: 2
You know the right answer?
Consider the following pseudocode for a sorting algorithm, for 0 < α < 1 and n > 1.
Questions
question
Mathematics, 16.07.2019 03:10