Question

Consider the following array: 2, 13, 16, 3, 7, 23, 12, 25. Show a trace of...

Consider the following array: 2, 13, 16, 3, 7, 23, 12, 25. Show a trace of execution for top-down mergesort using the method shown in lecture (where both sides are updated at once). Illustrate how the array is broken down, and then merged into an ordered state.

does this look correct?

1 (initial): [2, 13, 16, 3, 7, 23, 12, 25]

2 (down): [[2, 13, 16, 3],[7, 23, 12, 25]]

3 (down): [[[2, 13], [16, 3]],[[7, 23], [12, 25]]]

4 (mid): [[[[2], [13]], [[16], [3]]],[[[7], [23]], [[12], [25]]]]

5 (up): [[[2, 13], [3, 16]],[[7, 23], [12, 25]]]

6 (up): [[2, 3, 13, 16],[7, 12, 23, 25]]

7 (up): [2, 3, 7, 12, 16, 23, 25]

Homework Answers

Answer #1

Ans: Yes, according to the question where it is said, both sides are updated at once, the answer given by you is perfect. In merge sort, first array is divided in two sections until we get arrays of single element, and after that those arrays are merged in such an order that every new array by combining two array is sorted

1(Initial): [2, 13, 16, 3, 7, 23 , 12, 25]

2(down): [[2, 13, 16,3],[7, 23, 12, 25]]

3(down): [[[2,13],[16, 3]], [[7, 23], [12,25]]]

4 (mid): [[[[2], [13]], [[16], [3]]],[[[7], [23]], [[12], [25]]]]

5 (up): [[[2, 13], [3, 16]],[[7, 23], [12, 25]]]

6 (up): [[2, 3, 13, 16],[7, 12, 23, 25]]

7 (up): [2, 3, 7, 12, 16, 23, 25]

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Consider the following data: 25 24 18 20 21 18 16 20 23 17 15 13...
Consider the following data: 25 24 18 20 21 18 16 20 23 17 15 13 19 23 24 20 16 26 21 24 15 22 16 12 20 23 19 26 20 25 21 19 21 25 23 26 21 19 20 14 (a) Develop a frequency distribution using classes of 12-14, 15-17, 18-20, 21-23, and 24-26. Class Frequency   12-14   15-17   18-20   21-23   24-26     Total (b) Develop a relative frequency distribution and a percent frequency distribution using the classes...
A = [1 2 3 4 5 6 7 8 9 10 11 12 13 14...
A = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20] In MATLAB. Use a fully vectorized code (ie. no loops) to determine when the numbers have increased to at least 15 in the above array. Report answer to command window.
Consider the magic matrix: A = np.array([[17, 24, 1, 8, 15],                          [23, 5, 7, 14, 16],...
Consider the magic matrix: A = np.array([[17, 24, 1, 8, 15],                          [23, 5, 7, 14, 16],                          [ 4, 6, 13, 20, 22],                          [10, 12, 19, 21, 3],                          [11, 18, 25, 2, 9]]) The matrix A has 5 row sums (one for each row), 5 column sums (one for each column) and two diagonal sums. These 12 sums should all be exactly the same. Verify that they are the same by printing them and “seeing” that they are the same.
H C O F 3 , 7 9 , 13 12 , 16 M 1 ,...
H C O F 3 , 7 9 , 13 12 , 16 M 1 , 5 3, 7 2, 6 What is the obtained F ratio for the column variable? Correct answer if 3.5 but I don't know how to get there. I found the Sum of Square of column = 56, Mean square error is 48, and mean square variance of column equal to 56/(3-1)=28. I got the answer wrong. Please explain what did I do wrong. Thank...
City Code % Under 21 # of Fatals 1 16 3.822 2 7 0 3 5...
City Code % Under 21 # of Fatals 1 16 3.822 2 7 0 3 5 0.46 4 10 2.033 5 14 2.282 6 10 0.621 7 12 1.511 8 12 1.824 9 13 1.209 10 11 2.034 11 8 1.321 12 14 2.468 13 14 2.455 14 18 3.787 15 16 3.508 16 10 1.113 17 7 1.144 18 15 3.084 19 18 4.16 20 16 3.688 21 8 0.782 22 9 1.307 23 14 2.016 24 13 3.542...
Month 1 2 3 4 5 6 7 Value 25 14 21 13 20 24 16...
Month 1 2 3 4 5 6 7 Value 25 14 21 13 20 24 16 (b) Develop the three-month moving average forecasts for this time series. Month Time Series Value Forecast 1 25 2 14 3 21 4 13 5 20 6 24 7 16 Compute MSE. (Round your answer to two decimal places.) MSE = What is the forecast for month 8? (c) Use α = 0.2 to compute the exponential smoothing forecasts for the time series. (Round...
Dep Delay Arr Delay q1 -13 -9 q3 1 3 IQR 14 12 stdev 9.211846 9.660933...
Dep Delay Arr Delay q1 -13 -9 q3 1 3 IQR 14 12 stdev 9.211846 9.660933 negative 291 zero 39 positive 170 total (should be 500) 500 all data is for arrival data. please help me explain these can someone help me answer these questions and tell me how to put them in excel.thanx in advance 1.    Define a random variable (X) so that your chosen data set represents values of X. 2.    Is your chosen random variable discrete or...
Distance to Campus (miles) 37 5 4 6 16 5 8 12 6 12 13 25...
Distance to Campus (miles) 37 5 4 6 16 5 8 12 6 12 13 25 9 2 35 10 4 10 6 9 5 5 5 22 9 7 3 10 9 7 8 5 A) Use the Distance to Campus data to find the following statistics (don’t forget units). Give mean, standard deviation and median with one decimal, as needed: Sample size ____________ Range _______________ Mean ____________ Standard deviation ___________ Median _____________ B) Which is larger, the mean...
Chem 576: Crossword 3 1 2 3 4 5 6 7 8 9 10 11 12...
Chem 576: Crossword 3 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Across 2. Hydrogen cyanide is prepared from ammonia and methane is this process. 6. Metal used to catalyse the conversion of ammonia to NO. 7. Phosphoric acid is prepared by the action of sulfuric acid on ________. 10. Dinitrogen __________ is a blue liquid and decomposes readily...
Indices   DUR   DUR (OLD) 1   6   11 2   13   14 3   11   14 4   7   10...
Indices   DUR   DUR (OLD) 1   6   11 2   13   14 3   11   14 4   7   10 5   9   9 6   7   10 7   8   11 8   5   8 9   7   6 10   7   10 11   7   13 12   3   5 13   10   13 14   3   15 15   4   12 16   9   7 17   9   8 18   10   13 19   6   10 20   8   14 21   10   14 22   8   18 23   2   10 24   4   11 25   7   16 26  ...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT