Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Propose a data structure to use for the following situation. Justify your choices. You do not need to give complete code, but it should be

Propose a data structure to use for the following situation. Justify your
choices. You do not need to give complete code, but it should be clear
how your solution is intended to work. You can use all data structures and
operations on these data structures that have been described in lectures as
"black-box" without giving an implementation.
You want to write a simple "unpaid bill manager". New bills arrive
frequently. For each bill you also have a deadline for paying the bill. On
arrival of a bill you want to add the new bill to your structure. You always
want to pay the bill with the earliest deadline.
You also may want to know the total amount to pay for all bills with
deadlines less than or equal to a time T. That is, you want to efficiently
query your data structure to return the total amount to pay up to any time
T.
You may assume that the bill deadlines are integers (day numbers), and
at most one bill will arrive with a deadline on any day.
Your "unpaid bill manager" should be able to:
Add a new unpaid bill to your structure. (Note that the deadlines of
new bills are not necessarily in time order.)
Find the bill with the earliest deadline, output it, and delete it from
the structure.
Calculate the total cost of bills with deadlines up to T, for any time
T.
What is the time required for the three basic operations (add a new bill,
find the next bill to pay, and calculate total amount of bills up to time T?
image text in transcribed

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

Step: 3

blur-text-image

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

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions

Question

Identify the Fourteen Forces of Magnetism.

Answered: 1 week ago