Answered step by step
Verified Expert Solution
Link Copied!

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. 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. 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. 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. 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. 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. 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 ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Numerical Methods For Engineers

Authors: Steven C. Chapra, Raymond P. Canale

5th Edition

978-0071244299, 0071244298

More Books

Students also viewed these Operating System questions

Question

Contrast intrinsic motivation with extrinsic motivation.

Answered: 1 week ago