Question
In this assignment, you are tasked with creating a queue-like ADT. You will do this using a doubly-linked list (DLL) with dummy nodes. You will
In this assignment, you are tasked with creating a queue-like ADT. You will do this using a doubly-linked list (DLL) with dummy nodes. You will be presented with a list of methods that must be made with their descriptions. After creating the methods, you will have to write a simple command line interface for the marker to test your ADT. Lastly, you will provide a sequence of commands that the marker can use to explore each of the methods that you created. This sequence is called a demo. The queue-like ADT will consist of nodes containing integers for item type. This will be stored in a first-in-first-out structure but the whole structure can be sorted based on the item values if needed. The basic methods are enqueue and dequeue. Enqueue adds a given item as a new node to the end of the list. Dequeue deletes the first node in the list and returns that nodes item. The other methods are described in the Methods Section.
1. Default Constructor - This should initialize an empty doubly-linked list that contains only dummy nodes. The first dummy node should have an arbitrarily small integer as item. The second dummy node should have an arbitrarily large integer as item.
2. Copy Constructor - The should take another queue as a parameter and initialize an exact copy of the provided queue.
3. Is Empty - Return true if the list is empty/ only contains dummy nodes.
4. Print - Prints the contents of the queue in an easily readable way.
5. Enqueue - Takes an integer as a parameter and adds it to the end of the list.
6. Dequeue - Deletes the first node in the list and returns its value.
7. Priority Enqueue - Takes an integer as a parameter and sorted-inserts it into the queue. NOTE: This does not sort the list. It simply adds the new node using a sorted-insert algorithm.
8. Priority Dequeue - Takes an integer as a parameter. Delete the first instance of the integer in the list.
9. Sort - Sorts the list based on the item value of each node.
Your main program should provide a command line interface to interface to interact with your ADT. It must have the option to specifically make use of each of the 9 methods above. In addition, you must print the current queue before taking input from the user. Return the user to input after each method until a q or quit is input.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started