1. Sort (using MergeSort) an array of 8 random values. Show the recursion tree. Put the merge...
Fantastic news! We've Found the answer you've been seeking!
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 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.
Related Book For
Numerical Methods For Engineers
ISBN: 9780071244299
5th Edition
Authors: Steven C. Chapra, Raymond P. Canale
Posted Date: