Consider an array of size nine with the numbers in the following order: 40, 60, 20,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Consider an array of size nine with the numbers in the following order: 40, 60, 20, 80, 70, 90, 30, 10, 50. (a) Create the heap using the algorithm described in class. Show the heap as a tree. Show the heap as an array. Exactly how many comparisons did heap creation use? (b) Start with the heap created in Part (a). Show the array after each element sifts down during the Finish phase. How many comparisons does each sift use? What is the total number of comparisons after heap creation? Consider an array of size nine with the numbers in the following order: 40, 60, 20, 80, 70, 90, 30, 10, 50. (a) Create the heap using the algorithm described in class. Show the heap as a tree. Show the heap as an array. Exactly how many comparisons did heap creation use? (b) Start with the heap created in Part (a). Show the array after each element sifts down during the Finish phase. How many comparisons does each sift use? What is the total number of comparisons after heap creation?
Expert Answer:
Answer rating: 100% (QA)
a Creating the heap using the algorithm described in class The given array is 40 60 20 80 70 90 30 1... View the full answer
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Posted Date:
Students also viewed these operating system questions
-
Story plot: tall, square, symmetric. For each technique, give the relevant matrix equations to obtain the solution x, and point out the properties of the matrices involved. Highlight one potential...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
Elizabeth Is a nurse, and she just administered 1.8 milliliters of medication to one of her patients. Elizabeth knows that the amount of medication remaining in the patient's body wi decrease by a...
-
What are meeting minutes, and who is their intended audience?
-
Ka for acetic acid is 1.7 10-5 at 25C. A buffer solution is made by mixing 52.1 mL of 0.122 M acetic acid with 46.1 mL of 0.182 M sodium acetate. Calculate the pH of this solution at 25C after the...
-
Chandrasekhar (1961) has shown that the above (Bnard) problem can be solved in terms of the vorticity, which reduces the problem to a sixth-order eigenvalue problem for the perturbation in...
-
1. What advice do you have for Morris and Ellen? 2. What recommendations do you have for preparing children to lead changes in a company?
-
Kingsport Containers Company makes a single product with wide seasonal variations in demand. The company uses a job - order costing system and computes plantwide predetermined overhead rates on a...
-
Richardson Ski Racing (RSR) sells equipment needed for downhill ski racing. One of RSRs products is fencing used on downhill courses. The fence product comes in 150-foot rolls and sells for $215 per...
-
Calculate the benefits for each year of each scenario and discount them in columns C and D. Sum up these benefits to calculate the present value for each scenario. Calculate the costs for each year...
-
At a munitions factory, chemicals \(M\) and \(P\) have to be added to a vat containing chemical \(\mathrm{C}\). Chemicals \(\mathrm{M}\) and \(\mathrm{P}\) have to be added simultaneously to prevent...
-
An organ pipe open at both ends is tuned so that its fundamental frequency is a G. How long is the pipe? A. \(43 \mathrm{~cm}\) B. \(87 \mathrm{~cm}\) C. \(130 \mathrm{~cm}\) D. \(173 \mathrm{~cm}\)...
-
Two springs have spring constants \(k_{1}\) and \(k_{2}>k_{1}\). Connected as shown in Figure P8.53, they act like one spring. Compute the spring constant of the combination. Is the combination...
-
The change in color when acetone is placed on the wing is due to the difference between the indices of refraction of ace- tone and air. Consider light of some particular color. In acetone, A. The...
-
This exercise will help you to explore how organizations use public affairs activities when they address issues. It also introduces some of the steps involved in identifying and analyzing the...
-
Which of the following is the limitation of financial statement analysis? A B C D Historical analysis Ignores price level changes Not free from bias All of the above
-
Stephen Schor, an accountant in New York City, advised his client, Andre Romanelli, Inc., to open an account at J. P. Morgan Chase Bank, N.A., to obtain a favorable interest rate on a line of credit....
-
We wrote the class to have public methods called size (to read the number of elements of the list) and get (to access the element value at a specific index). Why is this approach better than...
-
Write a program that produces as output the words of The House That Jack Built. Use methods for each verse and for repeated text. Here are lyrics to use: This is the house that Jack built. This is...
-
Write a method called evenLevels that makes sure that all branches end on an even level. If a leaf node is on an odd level it should be removed from the tree. We will define the root as being on...
-
For the pediatrician presented in Example 1, find the probability that a randomly selected three-year-old girl is between 35 and 40 inches tall, inclusive. That is, find P(35 X 40). By-Hand...
-
The heights of a pediatricians three-year-old females are approximately normally distributed, with mean 38.72 inches and standard deviation 3.17 inches. Find the height of a three-year-old female at...
-
The scores earned on the mathematics portion of the SAT, a college entrance exam, are approximately normally distributed with mean 516 and standard deviation 116. What scores separate the middle 90%...
Study smarter with the SolutionInn App