Comparisons Required by Merge Sort - Leftmost Script - Mathematics Assessment Answer

Download Solution Order New Solution
Internal Code: 1AHAGJ

Mathematics Assessment Answer

TASK: Question  About 700 students take our exam. After grading, the scripts have to be sorted into ID order. How will we do this? One way is described below, followed by some questions. For simplicity, assume there are exactly 704 scripts.
  1. 1. Count off the scripts into 64 piles of 11 each.
  2. 2. Sort each pile into order using the following technique:
(i) Lay out the 11 scripts in a row on the table (ii) Find the script with the lowest ID. Do this in a manner similar to the least element algorithm; 1.2.: Put your finger on the leftmost script and visually scan rightwards until you find a script with a lower ID. Nove your finger there. Repeat until you reach the end of the row. You will then be touching the script with the lowest ID. (iii) Pick up this script, turn it over, and start the sorted pile with it. (iv) Repeat step (ii) and add the new script to the sorted pile. (v) Keep repeating step (iv) until all scripts are in the sorted pile. (vi) Turn the pile over. The scripts will be in ID order; lowest on top.
  1. Merge pairs of sorted piles to create 32 sorted piles with 22 scripts each.
For each pair, do this by repeatedly comparing the tops of two piles, picking up the one with the lower ID, turning it over and placing onto (or starting) the merged pile. When the merged pile is full, turn it over.
  1. Using a similar process to step 3. now create 16 sorted piles, then 8 and so on until there is just the one sorted pile we want.
To analyse the efficiency of the above algorithm two actions are crucial: (a) What are the maximum possible numbers of COMPs and of NOVEs required for the complete sorting task using the strategy described above? An alternative strategy total MergeSort, which require less COMPs but more MOVES. In principle you would start with 704 MOVEs to create 704 piles of 1 script each, but of course this is impracticable. Realistically you would start with 2 MOVES, 1 COMP and then 2 MOVEs to create a sorted pile of 2 scripts. You would then repeat this to create another pile of 2 scripts and then merge using at most 3 COMPs and 4 MOVEs to create a sorted pile of 4 scripts. Then create another pile of 4 scripts in a similar way and merge the two. And so on until you have a sorted pile of 64 scripts. Leave this aside and create ten more sorted piles of 64 scripts. Then progressively merge these eleven piles into one using the standard Merge Sort procedure. (b) What are the maximum possible numbers of COMPs and of MOVEs required for the complete sorting task using this modified total Merge Sort strategy? (c) Which of the two strategies would you recommend, and why? State any assumptions underlying your recommendation.
  1. Merge sort is to be used to sort a list of 8 distinct numbers from the set {1, 2, 3, 4, 5, 6, 7,8} into ascending order. Give examples of list orders that give the algorithm the (a) least trouble; (best case complexity) (1, 2, 3, 4, 5, 6, 7, 8) 4+4+4= 12 comparisons
(b) most trouble. (worst case complexity) (1,5, 3, 7, 8, 4, 6, 2) 46+7 = 17 comparisons "Trouble” is to be measured by the number of comparisons required. Calculate this number in each case. (c) What should we mean by an average amount of trouble (average case complexity), and how could it be calculated? Do not attempt to actually do the calculation, unless you have a lot of spare time to kill.] There are 8! = 40320 different orderings of {1,2,3,4,5,6,7,8). We would have to calculate the number of comparisons required to sort each of these into order and then take the average. (d) Is the number of comparisons required by Merge sort affected by the order of the original list? If so, what is the most that would ever be required (for list length 8)?
This Mathematics Assessment has been solved by our Mathematics experts at onlineassignmentbank. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.