Solve the data structure problem and realize the dictionary with queue

CSDN Q & A 2022-02-13 05:56:00 阅读数:815

solve data structure problem realize

Dictionary abstract data type ( Use a queue to complete the problem . Only queue in and queue out operations can be used to access the elements in the queue )
Set of data elements :
A collection of records of the same type , Each record includes a keyword and its value . Keywords must be unique , however
Several keywords can be mapped to the same value . in other words , Values need not be unique .
Basic operation :
(1)Make: Construct an empty dictionary .
(2)Size: Returns the number of records in the dictionary .
(3)IsEmpty: Returns true if the dictionary is empty , Otherwise return false .
(4)Clear: Reset the dictionary to empty .
(5)Insert: The given record is inserted into the dictionary .
(6)Remove: Records matching the given keyword are deleted , The record is returned , Otherwise, the dictionary remains unchanged .
(7)IsPresent: Returns true if there are records matching the given keyword , Otherwise return false .
(8)Find: If there are records matching the given keyword , Then the record is returned , If not , Then return to empty .




Take the answer :

Just use an array to represent the queue



Other answers 2:

It's not Ma Mingjun ?

copyright:author[CSDN Q & A],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/02/202202130555580329.html