Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Solution Divide and Conquer DAC approach has three steps at each level of recursion Divide the problem into number of smaller units called subproblems ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started