Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Implement the merge-sort algorithm a. Determine the correct basic operation 2. Test your algorithm on inputs of size 2^10, 2^11 ... 2^20. If this

1. Implement the merge-sort algorithm

a. Determine the correct basic operation

2. Test your algorithm on inputs of size 2^10, 2^11 ... 2^20.

If this is too slow then just run it on any set of powers of two.

3. Show the running time of each of these inputs

Choose a basic operation

Count the total number times that this basic operation is done for each

power of 2.

Display this count in a table

image text in transcribedimage text in transcribed
5. [12%] Give the time complexity for the following algorithm using two different approaches. You need to identify the basic operation first. F(int n) { If (n > 1) Return 2*F (n-1) ; Else Return 1; 1) [2%] What is the basic operation? 2) [2%]Set up the recurrence. Let T(n) be the # of basic operations. T(n) = 3) [4%] Use backward substitution to solve the recurrence and indicate the time complexity. 4) [4%] Write an iterative algorithm to solve the same problem.ALGORITHM S(n) //Input: A positive integer n //Output: The sum of the first n cubes if n = 1 return 1 else return S(n - 1) + n * n * n A. What does this algorithm compute? B. What is its basic operation? C. Does the number of times of the basic operation executed depend on the nature of the inputs of the same size? D. Set up a recurrence relation for the number of times the algorithm's basic operation is executed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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_2

Step: 3

blur-text-image_3

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

Physics For Scientists And Engineers With Modern Physics

Authors: Raymond A Serway, John W Jewett

10th Edition

133767172X, 9781337671729

More Books

Students also viewed these Mathematics questions

Question

Trace Greek medical thought from Aesculapius to Hippocrates.

Answered: 1 week ago