Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. (15 marks) The ADTs Map, Dictionary and Priority Queue maintain collections of key-value entries, but support different operations. For each of these three ADTs
1. (15 marks) The ADTs Map, Dictionary and Priority Queue maintain collections of key-value entries, but support different operations. For each of these three ADTs and for the sequence of operations given in the tables below, show in the column 'operation' the name and arguments (if any) of this operation. If a given operation is not supported by any single operation of the ADT, then write "not supported". If the operation is supported, then show also, in the last two columns in the tables, the effect of applying this operation (the output, if any, and the collection after this operation is performed), assuming that the initial collection is (7, F), (8,Q), (3, H) Each operation is to be applied to the collection which is the result of the previous operation. Use the definition of these three ADTs as given in the lecture slides Operation description Map operation output collection after the operation insert the entry (6, R) remove an entry with key 5 insert the entry (3, E) return the number of entries remove an entry with the smallest key search for key 3 remove an entry with value B make the collection empty Operation description Dictionary operation output collection after the operation insert the entry (6, R) remove an entry with key 5 insert the entry (3, E) return the number of entries remove an entry with the smallest key search for key 3 remove an entry with value B make the collection empty Operation description Priority Queue operation output collection after the operation insert the entry (6, R) remove an entry with key 5 insert the entry (3, E) return the number of entries remove an entry with the smallest key search for key 3 remove an entry with value B make the collection empty 1. (15 marks) The ADTs Map, Dictionary and Priority Queue maintain collections of key-value entries, but support different operations. For each of these three ADTs and for the sequence of operations given in the tables below, show in the column 'operation' the name and arguments (if any) of this operation. If a given operation is not supported by any single operation of the ADT, then write "not supported". If the operation is supported, then show also, in the last two columns in the tables, the effect of applying this operation (the output, if any, and the collection after this operation is performed), assuming that the initial collection is (7, F), (8,Q), (3, H) Each operation is to be applied to the collection which is the result of the previous operation. Use the definition of these three ADTs as given in the lecture slides Operation description Map operation output collection after the operation insert the entry (6, R) remove an entry with key 5 insert the entry (3, E) return the number of entries remove an entry with the smallest key search for key 3 remove an entry with value B make the collection empty Operation description Dictionary operation output collection after the operation insert the entry (6, R) remove an entry with key 5 insert the entry (3, E) return the number of entries remove an entry with the smallest key search for key 3 remove an entry with value B make the collection empty Operation description Priority Queue operation output collection after the operation insert the entry (6, R) remove an entry with key 5 insert the entry (3, E) return the number of entries remove an entry with the smallest key search for key 3 remove an entry with value B make the collection empty
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