Using the heap implementation of a priority queue from Project 1, implement a program that keeps track
Question:
Using the heap implementation of a priority queue from Project 1, implement a program that keeps track of the user’s list of prioritized chores.
Data from Project 1
Using a heap, implement the priority queue ADT from Section 7.4. You can store the heap in arrays, similar to the solution to Self-Test Exercise 1. To have FIFO behavior for elements with equal priority, you should have a third array called entered. The value of entered[i] tells when the data in node number i entered the priority queue. For example, the first element added has an entered value of 1, the second element has an entered value of 2, and so on. When you are comparing two elements with equal priority, use the entered value to “break the tie” (so that if two elements have the same priority number, then the one with the earlier entered value will come out of the priority queue first).
Make sure you keep track of how many elements are in the heap so that if the size of the heap reaches the size of the arrays, you can increase the size of the arrays.
Step by Step Answer:
include using namespace std Priority queue class using heap implementation class PriorityQueue priva...View the full answer
Students also viewed these Computer science questions
-
Using a heap, implement the priority queue ADT from Section 7.4. You can store the heap in arrays, similar to the solution to Self-Test Exercise 1. To have FIFO behavior for elements with equal...
-
Give a complete implementation of a priority queue using the idea from the direct implementation. Priority Queue ADTA Direct Implementation If the number of possible priorities is large, then an...
-
write a job description for Bill Ryan's job. What other information would you need to write a better job description? Remember, this is a job description, not a help wanted ad. Please do your own...
-
The unadjusted trial balance of Simple Consulting Services as at December 31, 2021 is as follows: Cash Accounts receivable Prepaid insurance Supplies inventory Office equipment Accumulated...
-
Complete the frequency table that corresponds to the frequency table in the exercise indicated by adding the relative frequency and cumulative relative frequency columns, accurate to 3 decimals....
-
At the site of a spill of radioactive iodine, radiation levels were four times the maximum acceptable limit, so an evacuation was ordered. If R 0 is the initial radiation level (at t = 0) and t is...
-
What elements must be proven in order to be successful in a negligence suit? Illustrate your answer with a case (the facts of the case can be hypothetical).
-
Tarp Department Store is located in midtown Platteville. During the past several years, net income has been declining because of suburban shopping centers. At the end of the companys fiscal year on...
-
Provide the solution below in A4 sheet. and i will give you upvote Given Data :- Ap = 1777 mm 2. As 2 = 500 mm A's = 314 mm 2 fpk = 1700 MPa fp 0,1k 1530 MPa fy = 400 MPa Pre tensioned 900x500 mm...
-
Biogen, a biotechnology firm, had a beta of 1.70 in 1995. It had no debt outstanding at the end of that year. a. Estimate the cost of equity for Biogen, if the Treasury bond rate is 6.4%. b. What...
-
The heap in this chapter is referred to as a maxheap because the highest priority value is also the maximum value. Implement the heap as a minheap, in which the entry of the node with the highest...
-
Reimplement the binary search using a loop and no recursion. If you are familiar with Javas Comparable interface, then your implementation search an array of Comparable objects rather than an array...
-
List the information provided in corporate bond quotations.
-
Explain Milton Friedman's wall of separation between economic power and political power and what this has to do with his narrow view of corporate social responsibility.
-
Analyze the country of Taiwan for the below scenario. Scenario: The policymakers in Taiwan are acting and implementing policies to move their country's economy downward and rightward along the...
-
compare and contrast for-profit and nonprofit organizations (healthcare)in terms of their financial and economic policies. How do the tax regulations differ between both types of organizations? Do...
-
List two micro-economic decisions that you have made in the last week. For each one of the decisions, provide reason why you think it relates to 'microeconomics'?
-
A financial institution makes small loans to students. For example, it offers $500 for 16 weeks with $511.43 to be repaid at the end of this period. What is the financial institution's effective...
-
On December 24, 2014, the directors of Partridge Corporation, an accrual basis calendar year taxpayer, authorized a cash contribution of $10,000 to the American Cancer Association. The payment is...
-
When the Department of Homeland Security created a color-coded system to prepare government officials and the public against terrorist attacks, what did it do right and what did it do wrong?
-
In this exercise we look at memory locality properties of matrix computation. The following code is written in C, where elements within the same row are stored contiguously. Assume each word is a...
-
Caches are important to providing a high-performance memory hierarchy to processors. Below is a list of 32-bit memory address references, given as word addresses. 3, 180, 43, 2, 191, 88, 190, 14,...
-
For a direct-mapped cache design with a 32-bit address, the following bits of the address are used to access the cache. 1. What is the cache block size (in words)? 2. How many entries does the cache...
-
A project that is expected to generate annual after-tax cash flows of $2,200 for each of the next 20 years. The project's cost of capital is 8.5 percent and it has an IRR of 9.058 percent. What is...
-
Gabbie has to decide between the following two choices: Option 1: Get $320 with probability 35.97%, and $84.15 with the complement probability. Option 2: Get $94.95 with 100% probability. Her utility...
-
Why are unpaid accruals a "temporary" source of cash? Please give some details and examples.
Study smarter with the SolutionInn App