logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

If you choose to go with array, don\'t set the capacity in the constructor.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

This Priority Queue has the following requirements:

You may implement your Priority Queue contiguously (with an array), or dynamically (with a linked list), with the following restrictions:

O If you choose to go with array, don't set the capacity in the constructor. Instead, use an expression parameter (refer to Lab 7) to define the length of the array

O

If you go with a linked list, be careful with your memory management. Not only will you require a destructor, but it will likely need a recursive function

The Priority Queue must be templated

O

It will require a single typename parameter, to indicate what it holds

。 To that end, though you're free to use structs internally, you won't be using them from the client side, unless what's being held just happens to be structs

。 You'll have to write your enqueue method to accept two parameters: a T to store, and a long for its priority

0

This should go without saying, but because it's templated to hold any type, you obviously can't hardcode any stored types

e.g. if you start writing it to hold strings for testing purposes, make sure you remember to delete all occurrences of 'string' from the final version

As before, lower priority values have a higher priority for being removed

O

e.g. if you add ("eenie", 33), ("meenie", 20), and ("miney", 40), then the first element to be removed will be "meenie"

In addition to enqueue and dequeue, also add:

O A bool isEmpty()

O AT peek(), to return what the next dequeue will return, but without actually removing it from the Priority Queue

O An int count(), to return the current length of the Priority Queue

There should not be any cout (or cin) statements anywhere in your Priority Queue class!

Additionally, write a very simple program to demonstrate your Priority Queue.

For this client program, instantiate the Priority Queue to store std::strings, and let the user choose to add and remove as many elements as they wish (with whatever priorities they like), until they choose to quit.

(5/5)
Attachments:

Expert's Answer

444 Times Downloaded

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

444 Times Downloaded

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

508 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

814 Answers

Hire Me
expert
Husnain SaeedComputer science

706 Answers

Hire Me
expert
Atharva PatilComputer science

749 Answers

Hire Me

Get Free Quote!

412 Experts Online