Consider the following modified merge sort algorithm. Note that the Merge procedure is identical to the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Consider the following modified merge sort algorithm. Note that the Merge procedure is identical to the one used in the Merge-Sort algorithm we discussed in class. Modified-Merge-Sort (A, p, r) // Input: An array A[p..r] of n pair-wise comparable elements // Output: Array A[p..r] sorted in non-decreasing order 1 if p < r 2 3 4 5 6 7 8 mid1= p + (r - p)/3 mid2 P + 2* (r p)/3 Modified-Merge-Sort (A, p, mid1) Modified-Merge-Sort (A, mid1 + 1, mid2) Modified-Merge-Sort (A, mid2 + 1, r) Merge (A, p, mid1, mid2) Merge (A, p, mid2, r) = 1. (6pts) Perform Modified-Merge-Sort(A, 1, 9) on array A[1..9] = <9, 4, 6, 3, 7, 2, 8, 1, 5>. List all the updated arrays after each Merge operation. 2. (3pts) Formulate a recurrence relation to describe the running time of algorithm Modified-Merge-Sort (A, p, r). Make sure to specify the base case(s). 3. (3pts) Solve the recurrence relation to give a tight bound (using 8) on the algorithm's running time. Consider the following modified merge sort algorithm. Note that the Merge procedure is identical to the one used in the Merge-Sort algorithm we discussed in class. Modified-Merge-Sort (A, p, r) // Input: An array A[p..r] of n pair-wise comparable elements // Output: Array A[p..r] sorted in non-decreasing order 1 if p < r 2 3 4 5 6 7 8 mid1= p + (r - p)/3 mid2 P + 2* (r p)/3 Modified-Merge-Sort (A, p, mid1) Modified-Merge-Sort (A, mid1 + 1, mid2) Modified-Merge-Sort (A, mid2 + 1, r) Merge (A, p, mid1, mid2) Merge (A, p, mid2, r) = 1. (6pts) Perform Modified-Merge-Sort(A, 1, 9) on array A[1..9] = <9, 4, 6, 3, 7, 2, 8, 1, 5>. List all the updated arrays after each Merge operation. 2. (3pts) Formulate a recurrence relation to describe the running time of algorithm Modified-Merge-Sort (A, p, r). Make sure to specify the base case(s). 3. (3pts) Solve the recurrence relation to give a tight bound (using 8) on the algorithm's running time.
Expert Answer:
Answer rating: 100% (QA)
1 After performing ModifiedMergeSortA updated arrays after each Merge operation are Merge A 1 ... View the full answer
Related Book For
Computer Organization and Design The Hardware Software Interface
ISBN: 978-0124077263
5th edition
Authors: David A. Patterson, John L. Hennessy
Posted Date:
Students also viewed these programming questions
-
To ensure that you can provide the best service to this client group, you have consulted a health and nutritionist specialist to provide advice on food types and the best diet which can be combined...
-
Angela owns 250 shares that currently trades at $80 each. She declares a 2-for-1 consolidation. What is the approximate value of her portfolio?
-
An ammonia bath is the one most widely used for depositing Pd-Ni alloy coatings. The article "Modelling of Palladium and Nickel in an Ammonia Bath in a Rotary Device" (Plating and Surface Finishing,...
-
Fill in each blank so that the resulting statement is true. I find (f g)(x) by replacing each occurrence of x in the equation for_______ with________ .
-
Assume that a 1.00-kg ball is thrown solely by the action of the forearm, which rotates about the elbow joint under the action of the triceps muscle, Fig. 8-45. The ball is accelerated uniformly from...
-
Suppose the average return on T-Bills was 1%. The average factor risk premiums are the following: market (MKT): 6% size (SMB): 2% value (HML): 3% We have the following information about two managers:...
-
Consider the all-possible-regressions analysis of the National Football League data in Problem 10.2. Identify the subset regression models that are \(R^{2}\) adequate (0.05). Data From Problem 10.2...
-
How is break-even point defined? What are the differences among the formula, graph, and income statement approaches for computing breakeven?
-
You are given the information below. Assuming the market is efficient and the stocks are correctly priced, what is the expected return on the market? Security Beta E[R] New Sportswear 0.6 13% Old...
-
As a financial analyst at Glencolin International (GI) you have been asked to evaluate two capital investment alternatives submitted by the production department of the firm. Before beginning your...
-
Determine the demographic segment most likely to use social media. Discuss how social media influences the healthcare consumer and to what extent? Why other segments of the population are less likely...
-
Businesses often price discriminate, charging different customers different prices for the same good. It is usually the case that the customer who pays the higher price is subsidizing the customer...
-
A national survey poll found that two-thirds of Americans polled could not name all three branches of the United States government nor a single Supreme Court justice. Another poll found that 91...
-
Two recessive traits in micedroopy ears and flaky tailare caused by genes that are located 6 mu apart on the same chromosome.A true-breeding mouse with normal ears (De) and a flaky tail (ft) was...
-
A codon for leucine is UUA. A mutation causing a single-base substitution in a gene can change this codon in the transcribed mRNA into GUA (valine), AUA (isoleucine), CUA (leucine), UGA (stop), UAA...
-
In Ayrshire cattle, the coat can be either red and white or mahogany and white. The mahogany and white phenotype is caused by the allele SM. The red and white phenotype is controlled by the allele...
-
(1 point) A solid is bounded below by the cone, z = + y, and bounded above by the sphere of radius 5 centered at the origin. Find integrals that compute its volume using Cartesian, cylindrical, and...
-
Before the latest financial crisis and recession, when was the largest recession of the past 50 years, and what was the cumulative loss in output over the course of the slowdown?
-
Write down a Verilog module implementation of a 2-to-4 decoder (and/or encoder).
-
Calculate (1.666015625 10 0 1.9760 10 4 ) + (1.666015625 10 0 -1.9744 10 4 ) by hand, assuming each of the values are stored in the 16-bit half precision format described in Exercise 3.27 (and...
-
Give an algorithm for constructing the sum-of-products representation for an arbitrary logic equation consisting of AND, OR, and NOT. The algorithm should be recursive and should not construct the...
-
The suitability concern discussed by Kroll and Park most likely deals with: A. governance. B. transparency. C. investment horizon. Kevin Kroll is the chair of the investment committee responsible for...
-
Which of Parks statements regarding the asset allocation approaches is correct? A. Only Statement 3 B. Only Statement 4 C. Both Statement 3 and Statement 4 Kevin Kroll is the chair of the investment...
-
Based on the forecasted environment, liquidity planning should take into account that general partners may: A. call capital at a slower pace. B. make distributions at a faster pace. C. exercise an...
Study smarter with the SolutionInn App