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 23:30
To check spelling errors in a document, the word application uses the to determine appropriate spelling. internet built-in dictionary user-defined words other text in the document
Answers: 1
question
Computers and Technology, 23.06.2019 11:00
What is the name of the sound effect that danny hears
Answers: 1
question
Computers and Technology, 23.06.2019 16:50
15: 28read the summary of "an indian's view of indian affairs."15 betterin "an indian's view of indian affairs," it is asserted that conflicts could be reduced if white americansunderstood native americans..pswhich of the following would make this summary more complete? eleo the fact that chief joseph believes the great spirit sees everythinthe fact that chief joseph was born in oregon and is thirty-eight years oldo the fact that chief joseph states that he speaks from the hearthehehethe fact that chief joseph of the nez percé tribe made this claimebell- ==feetle===-felsefe ==submitmark this and retum.=
Answers: 3
question
Computers and Technology, 23.06.2019 23:00
Computer programming is one type of what career
Answers: 1
You know the right answer?
Consider the following pseudocode for a sorting algorithm, for 0 < α < 1 and n > 1.
Questions
question
English, 10.11.2020 20:00
question
Mathematics, 10.11.2020 20:00
Questions on the website: 13722367