Question: (a) [2 points] Run PARTITION on the array [4, 7, 2, 9, 10, 1, 3, 8,5,6]. Show every step that changed the array. Motivate your
![(a) [2 points] Run PARTITION on the array [4, 7, 2,](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f4f18caf032_65266f4f18c1e03b.jpg)
(a) [2 points] Run PARTITION on the array [4, 7, 2, 9, 10, 1, 3, 8,5,6]. Show every step that changed the array. Motivate your answer by explaining in your own words how PARTI- TION updates the array. (b) (2 points] Consider the array [9, 10, 14, 11, 15,5, 4, 3, 8, 1, 12, 18, 17, 2, 16, 13, 6, 7). We plan to run SELECTION. Thus we divide the array into groups of 5 consecutive elements (as far as possible) and compute their respective medians, as well as the median of me- dians. Show how all elements relate in a similar way to Figure 9.1 from the book (slide 33), but instead of dots draw the actual numbers. For example (not the right answer): 2 4 7 1 5 10 6 11 17 11 12 14 18 16 9 15 (Note: make sure to align the medians and order them left to right as small to large.) (Note: you do not need to motivate your answer.) (a) [2 points] Run PARTITION on the array [4, 7, 2, 9, 10, 1, 3, 8,5,6]. Show every step that changed the array. Motivate your answer by explaining in your own words how PARTI- TION updates the array. (b) (2 points] Consider the array [9, 10, 14, 11, 15,5, 4, 3, 8, 1, 12, 18, 17, 2, 16, 13, 6, 7). We plan to run SELECTION. Thus we divide the array into groups of 5 consecutive elements (as far as possible) and compute their respective medians, as well as the median of me- dians. Show how all elements relate in a similar way to Figure 9.1 from the book (slide 33), but instead of dots draw the actual numbers. For example (not the right answer): 2 4 7 1 5 10 6 11 17 11 12 14 18 16 9 15 (Note: make sure to align the medians and order them left to right as small to large.) (Note: you do not need to motivate your answer.)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
