Question: 1. Sort (using MergeSort) an array of 8 random values. Show the recursion tree. Put the merge portion at the bottom of the tree, i.e
- 1. Sort (using MergeSort) an array of 8 random values. Show the recursion tree. Put the merge portion at the bottom of the tree, i.e extend the tree further down for that portion of the code. How many (total) comparisons were done in the merge method?
- 2. Sort (using MergeSort) an array of 8 values that are all the same. Show the recursion tree. Put the merge portion at the bottom of the tree, i.e extend the tree further down for that portion of the code. How many (total) comparisons were done in the merge method?
- 3. Sort (using QuickSort) an array of 8 random values. Show the recursion tree. Put the results of the partition method directly beneath the original array values. For recursions, only show the portion of the array that is affected. How many (total) comparisons were done in the partition method? How many swaps?
- 4. Sort (using QuickSort) an array of 8 values that are all the same. Show the recursion tree. Put the results of the partition method directly beneath the original array values. For recursions, only show the portion of the array that is affected. How many (total) comparisons were done in the partition method? How many swaps?
- 5. Create a sorted array of 8 distinct values. Give an example of the worst-case search where the value is within the bounds of the array and where it is outside the bounds (low and high) and the best case search. Show all steps.
- 6. Write a divide and conquer recursive algorithm to find the largest value in an unsorted list.
Step by Step Solution
3.33 Rating (159 Votes )
There are 3 Steps involved in it
Solution Divide and Conquer DAC approach has three steps at each level of recursion Divide the problem into number of smaller units called subproblems ... View full answer
Get step-by-step solutions from verified subject matter experts
