Problem

Consider an application that uses a priority queue. You have two implementations available...

Consider an application that uses a priority queue. You have two implementations 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.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 11
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT