Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

 

 

 

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 node's item. The other methods are described in the Methods Section. Methods 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. Main Program 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. Demo In your README or in a separate file provide a list of commands that can be followed to provide a full tour of your ADT. This tour must involve each of the above methods. Submission Please submit all program files along with a README file that contains the following: Identifying information, Name, Student Number, ect. A brief introduction to the problem. An overview of your code, what does it do, how does it do it, what approach did you use, ect. An explanation of how your code should be compiled and run. Command line instruc- tions is preferred. If this relies on a specific IDE please include information about setup for that IDE. Total Marks: 25

Step by Step Solution

There are 3 Steps involved in it

Step: 1

python class Node def initself ... 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

Global Marketing

Authors: Svend Hollensen

8th Edition

1292251808, 9781292251806

More Books

Students also viewed these Operating System questions