subject
Computers and Technology, 15.02.2021 20:10 india73

Consider the pseudo-code below for merge sort. Re-write the for-loop as a while loop in the merge sort pseudo-code. (You do not need to show the modified while-loop merge sort.) Then count how many lines need to execute to sort the array [3, 2, 1] for both algorithms. Show some work to receive full (and partial) credit. Only count lines the computer thinks on. Note: for merge sort, do not count the function calls, splits or array creation. Just the number of lines inside the merge function. Also, assume no work needs to be done merging a size 1 and 0 array. (Example: sorting [2, 1] merge = 14 lines.)Also, find an exact formula for the number of lines needed to be run in both the insertion sort and merge sort pseudo-code. This formula should be for arrays of size n that are in the reverse of sorted (e. g. [8, 7, 6, 5, 4, 3, 2, 1] with n = 8). Give the ranges of n where merge sort performs better than insertion sort. For full points, you cannot use a recursively defined function for merge sort. TopDownMerge(AL, iBegin, iMiddle, iEnd, BI]) i = iBegin, J = iMiddle ; 1 wnLe unere are elements in the left or right runs.. for (k= iBegin; k < !End; k++) { // If left run head exists and is <= existing right run head if (1 < iMiddle && (j >= iEnd 11 A[1] <=A[j])) { B[k] = A[1]; else t B[k] = A[j]; jj1;

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 21:40
Write c function that can replace all the positive elements to 0 and negative to 1 in undefined length one-dimensional array. test your program in the main program by defining one-dimensional array of 6 elements
Answers: 1
question
Computers and Technology, 22.06.2019 23:20
How can you tell if someone sent you a text message to your email instead of a email
Answers: 1
question
Computers and Technology, 23.06.2019 01:20
Me with this program in c++ ! computers represent color by combining sub-colors red, green, and blue (rgb). each sub-color's value can range from 0 to 255. thus (255, 0, 0) is bright red. (130, 0, 130) is a medium purple. (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (in other word, equal amounts of red, green, blue yield gray).given values for red, green, and blue, remove the gray part. ex: if the input is 130 50 130, the output is: 80 0 80. thus, find the smallest value, and then subtract it from all three values, thus removing the gray.
Answers: 3
question
Computers and Technology, 24.06.2019 02:20
Peter is thinking of a number which isless than 50. the number has 9 factors.when he adds 4 to the number, itbecomes a multiple of 5. what is thenumber he is thinking of ?
Answers: 1
You know the right answer?
Consider the pseudo-code below for merge sort. Re-write the for-loop as a while loop in the merge so...
Questions
question
Mathematics, 03.07.2019 13:10
question
Mathematics, 03.07.2019 13:10
Questions on the website: 13722361