Answered step by step
Verified Expert Solution
Question
1 Approved Answer
3 The Priority Queue ADT The Priority Queue abstract data type (ADT) is similar to an ordinary Queue ADT where each element is inserted with
3 The Priority Queue ADT The Priority Queue abstract data type (ADT) is similar to an ordinary Queue ADT where each element is inserted with an associated key. The key determines the element's priority A Priority Queue ADT does not enforce a first-in-first-out (FIFO) policy. Instead, elements are dequeued by order of priority. For two (or more) elements of equal priority, it is not specified which one has priority. Some priority queues are implemented in such a way as to enforce a FIFO policy among equal priority elements. The interface of the Priority Queue ADT contains the following main functionality: insert (el ElementType, key KeyType) Inserts the pair (el, key) into the priority queue remove) Removes and returns the element with the smallest key. minO Returns but does not remove the element with the smallest key 4 Your assignment Your assignment is to implement a bounded Priority Queue ADT in your language of choice together with contractual specifications. Functions remove) and min follow the rules of a regular queue in the case where the collection contains more than one entry with the same key. You must use a binary heap for the implementation of the Priority Queue ADT. You must define both the heap and the priority queue from scratch, instead of reusing library Based on your choice of programming language, contracts may be provided through native support (e.g Clojure), through third party support (e.g. adbe in Java), through macro facilities (e.g. CLOS for Common Lisp), or through language extensions (e.g. Aspect.J for Java). An extensive list of technologies is provided in the "design by contract" wikipedia article at http://en.wikipedia.org/wiki/Design-by.contract#Language-support 5 What to submit Please follow the instructions carefully: 1. Prepare a README.txt file with detailed instructions on what tools, if any, we need in addition to the language compiler, how to install and configure these tools and how to run code
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