Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

implement Programming Problems 6 and 7c. EXTRA CREDIT: You can get up to a 25/20 by completing 7C. Even though this is extra credit, you

image text in transcribedimage text in transcribedimage text in transcribed

implement Programming Problems 6 and 7c.

EXTRA CREDIT: You can get up to a 25/20 by completing 7C. Even though this is extra credit, you should at least look at it (as you are likely to see it again very soon)

For this assignment you may (and probably should) use the C++ STL queue and priority_queue

_________________________________

So at a very high level. You are creating a priority queue that has the events. You can have arrival and departure events. This is sorted by the time of arrival or departure (respectively). Because it is a priority queue, every add or delete action forces the built-in functions of the priority queue to sort it on the time of arrival. Priority queues normally sort o the highest (time) but we want it to sort on lowest. As a result you have a mix of arrival and departure events mixed in with each other.

If it is an arrival type of event at the top of the priority queue: Get the value of the top item, then pop it off. If there are no people in the bankline (queue) and the teller is available then process that event. In processing the event, we add a departure event to the priority queue (and it will sort itself), starting at the current time plus the listed transaction time (teller is unavailable for more customers during that transaction. In that departure even we keep track of the original arrival time.

If it is a departure event at the top of the priority queue: Get the value of the top item then pop it off and process the departure. If there are no people in the bankline (queue). Because someone just finished with the teller, the teller is now available for another customer. Look in the bankline (queue) to see if there are any people in the bankline.

When you have a departure event, you have enough information to determine how much the customer waited.

USE LANGUAGE C++ and please dont just copy other answers availabe here on chegg

acess priority queue, use the following i nclude statement: #include , enever you need a queue or a priority queue for any of the following problems, use the classes OurQueue uurPriorityQueue that Programming Problems 1 and 2 ask you to write. an Implement the palindrome-recognition algorithm described in Section 13.2.2. Implement the recognition algorithm that you wrote to solve Exercise 2 using the classes OurQueue, as described in Programming Problem 1, and OurStack, as described in Programming Problem 1 of Chapter 6 5. Implement the radix sort of an array by using a queue for each group. The radix sort is discussed in Sec- 6. Implement the event-driven simulation of a bank that this chapter described. A queue of arrival events eue, sorted by the time of the event. Use a link-based implementation for the priority queue. tion 11.2.3 of Chapter 11 ure events in a will represent the line of customers in the bank. Maintain the arrival events and depart The input is a text file of arrival and transaction times. Each line of the file contains the arrival time and required transaction time for a customer. The arrival times are ordered by increasing time. our program must count customers and keep track of their cumulative waiting time. These statistics are sufficient to compute the average waiting time after the last event has been processed. Display a trace or the events executed and a summary of the computed statistics (the total number of arrivals and average ne spent waiting in line). For example, the input file shown in the left columns of the following table ould produce the output shown in the right column acess priority queue, use the following i nclude statement: #include , enever you need a queue or a priority queue for any of the following problems, use the classes OurQueue uurPriorityQueue that Programming Problems 1 and 2 ask you to write. an Implement the palindrome-recognition algorithm described in Section 13.2.2. Implement the recognition algorithm that you wrote to solve Exercise 2 using the classes OurQueue, as described in Programming Problem 1, and OurStack, as described in Programming Problem 1 of Chapter 6 5. Implement the radix sort of an array by using a queue for each group. The radix sort is discussed in Sec- 6. Implement the event-driven simulation of a bank that this chapter described. A queue of arrival events eue, sorted by the time of the event. Use a link-based implementation for the priority queue. tion 11.2.3 of Chapter 11 ure events in a will represent the line of customers in the bank. Maintain the arrival events and depart The input is a text file of arrival and transaction times. Each line of the file contains the arrival time and required transaction time for a customer. The arrival times are ordered by increasing time. our program must count customers and keep track of their cumulative waiting time. These statistics are sufficient to compute the average waiting time after the last event has been processed. Display a trace or the events executed and a summary of the computed statistics (the total number of arrivals and average ne spent waiting in line). For example, the input file shown in the left columns of the following table ould produce the output shown in the right column

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

Students also viewed these Databases questions

Question

=+23-1 Describe sleep as a state of consciousness.

Answered: 1 week ago