Consider an application that uses a priority queue. You have two implementations of a priority queue available. One implementation uses an array to maintain the entries in the priority queue, while...


Consider an application that uses a priority queue. You have two implementations of a priority queue available. One implementation uses an array to maintain the entries in the priority queue, while the other uses a linked chain. Compare the performances of these implementations for each of the following sequences of operations on a priority queue.


a. Insert 100 objects having the priorities 1, 2, 3, . . . , 99, 100.


b. Insert 100 objects having priorities 100, 99, 98, . . . ., 2, 1.


 c. Add 100 objects having random priorities within the range 1 to 100.


 d. Starting with 100 objects in the priority queue having priorities 1 through 100, remove them all.


e. Starting with 100 objects in the priority queue having priorities 1 through 100, repeat the following pair of operations 1000 times:


Add an item having a random priority within the range 1 to 100.


Remove an item.

Nov 15, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here