finish implementation of the Abstract Data Type (ATD) for a Maximum Priority Queue, as represented by the C++ class MaxPriorityQueueLinkedList which has been partially written for you. To build your...


finish implementation of the Abstract Data Type (ATD) for a Maximum Priority Queue, as represented by the C++ classMaxPriorityQueueLinkedListwhich has been partially written for you.



To build your linked list representation of the Max Priority Queue, you must use theNodeclass( provided) which stores a single integer value and provides a "next" pointer. You will need to implement your methods using a singly-linked list of Nodes that will be accessed by the private "head" pointer that is provided as a part of theMaxPriorityQueueLinkedListclass.



Details


Specifically you will need to write these methods of theMaxPriorityQueueLinkedListclass:




  • push() - push a new integer value into a the Max Priority Queue. You must create a new Node instance and insert it into the linked list that represents your Max Priority Queue. You may insert it anywhere you like within the current existing Queue.



  • pop() - remove the current MAXimum value in the Priority Queue from the linked list and return its VALUE (an integer) as a result of the pop function.( Do not return a pointer to the Node that contains the value or a copy of the Node itself). You will probably need to search (linearly) through the entire current linked list you have created using pop() to find the maximum value. You will then need to properly "unlink" that Node from the list, repair the linked list, delete the node, and then return the value of that Node as the return value of your function. If your Priority Queue is empty when the pop() method is called, you should return a value of -1 to indicate that there was nothing to pop.



  • getSize() - return the count of items that exist in the Max Priority Queue. Return zero if the queue is empty.



  • isEmpty() - return true if the Max Priority Queue is empty, otherwise return false;



Testing


Test your Max Priority Queue interactively using the working code provided inmain().



  • You will see a preliminary grade assessment printed out before the interactive portion of your program begins. This will give you an indication of which parts of your code are failing and should provide a fairly accurate representation of your final score (subject to my review after your submission).

  • You may also choose to uncomment the testMe() function that has also been provided to provide a preliminary assessment of your grade (80% of your grade will be based on execution of your code). This function is preliminary - but I've tried to write it in a way that I can use verbatim for this part of your grade. (Final grade is subject to my review)

Oct 06, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here