Write a program to: [120] = 20 1. Build a heap using user input elements and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program to: [120] = 20 1. Build a heap using user input elements and print the heap (in order) 2. Delete the elements from the heap which are divisible by 5, print the deleted elements and rebuild the heap. If there is no element divisible by five or heap is empty then print an appropriate message 3. Allow user to check the level of any node which he/she wants to 4. Write a function leave Count() that takes as a parameter a pointer to the root node of a heap and returns the number of leaves Write a program to: [120] = 20 1. Build a heap using user input elements and print the heap (in order) 2. Delete the elements from the heap which are divisible by 5, print the deleted elements and rebuild the heap. If there is no element divisible by five or heap is empty then print an appropriate message 3. Allow user to check the level of any node which he/she wants to 4. Write a function leave Count() that takes as a parameter a pointer to the root node of a heap and returns the number of leaves
Expert Answer:
Answer rating: 100% (QA)
Answer Heres a C program that implements the functionalities you described include include include using namespace std Function to print the elements ... View the full answer
Related Book For
Data Structures and Algorithm Analysis in Java
ISBN: 978-0132576277
3rd edition
Authors: Mark A. Weiss
Posted Date:
Students also viewed these programming questions
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Complete the attached SWOT Worksheet using information from the Cotopaxi case. Use your SWOT Worksheet to help you answer the question: What should Davis Smith/Cotopaxi do (for company...
-
Roadside Markets has a 6.75 percent coupon bond outstanding that matures in 10.5 years. The bond pays interest semiannually. What is the market price per bond if the face value is $1,000 and the...
-
At December 31, 2020, the balance sheet of Meca International included the following shareholders' equity accounts: ($ in millions) $ 90 Shareholders' Equity Common stock, 90 million shares at $1 par...
-
A current loop lies in the \(x y\) plane, with the current circulating counterclockwise when viewed from the positive \(z\) axis. Is there a torque on the loop, and if so, in what direction, if a...
-
CRS Products Inc. uses a job order cost system. Selected transactions dealing with factory items for the month follow: a. Requisitioned indirect materials from storeroom, $3,200. b. Purchased, on...
-
12. "New competition is not between what companies produce in their factories, but between what they add to their factory output in the form of packaging, services, advertising, customer advice,...
-
Fairy Company reported the following flexible budget, as-if budget, and actual results. The company's materials quantity variance is: Flexible Budget "As-if" Budget Actual Results Direct Materials...
-
A 4.00 m long uniform beam is supported by a pivot at one end and a cable at the other end. The beam has a mass of 15.0 kg and supports a 25.0 kg box as shown. Calculate the tension, T, in the cable....
-
An object has mass 10 kg and weight 98 N near the Earth's surface. What is the weight of the object at an altitude of h = 2RE (above the earth's surface, RE is the earth's radius)? a) 294 N b) 196 N...
-
Snell's law helps us to determine How much time light spends in a material The angle by which light bends when entering a different material The speed of light in a vacuum with standard temperature...
-
A merry-go-round has an angular velocity of 5.60 rad/s. A ribbon is tied at the end of one of the arms and it has speed of 3.40 m/s. At what distance is the ribbon from the center of the...
-
The imaginary line perpendicular to the incident ray onto a materials interface is known as a Tangent line Normal line Skewed line Bent line
-
Write a program in C++ for a simple Calculator which perform Addition, Subtraction, Multiplication and Division using functions.
-
Evaluate the line integral, where C is the given curve. C x 2 dx + y 2 dy, C consists of the arc of the circle x 2 + y 2 = 4 from (2, 0) to (0, 2) followed by the line segment from (0, 2) to (4, 3)
-
A large number of deletions in a separate chaining hash table can cause the table to be fairly empty, which wastes space. In this case, we can rehash to a table half as large. Assume that we rehash...
-
Rewrite heapsort so that it sorts only items that are in the range low to high which are passed as additional parameters.
-
Repeat Exercise 3.11, maintaining the singly linked list in sorted order. Assume that a singly linked list is implemented with a header node, but no tail node, and that it maintains only a reference...
-
Construct a stem-and-leaf plot of the poverty data discussed in Example 6. Approach We will use Minitab. The steps for constructing the graphs using Minitab or StatCrunch are given in the Technology...
-
Draw a dot plot for the number of arrivals at Wendys data from Table 8. Approach The smallest observation in the data set is 1 and the largest is 11. Write the numbers 1 through 11 horizontally. For...
-
Figure 16 displays the histogram obtained in Example 4 for the five-year rate of return for large-blended mutual funds. Describe the shape of the distribution. Approach We compare the shape of the...
Study smarter with the SolutionInn App