Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ assignment help. Please post output as well Your assignment is to write and compare two implementations of a priority queue whose highest priority element

C++ assignment help. Please post output as well

Your assignment is to write and compare two implementations of a priority queue whose highest priority element is the one with the smallest key value. The elements have the following declarations:

The first implementation uses a minimum heap. You need to modify the heap operations to keep the minimum, rather than maximum, element in the root. The comparison function should compare key fields.

The second implementation uses a linear linked list, whose elements are ordered by key value.

Test Data

Create a data set that contains 50 items with priorities generated by a random-number generator.

Comparing the Implementations

To compare the operations, you must modify the Enqueue and Dequeue operations to count how many elements are accessed (compared or swapped, in the case of reheaping) during its execution.

Write a driver to Enqueue and Dequeue the 50 test items and print out the number of elements accessed for the Enqueue and Dequeue operations. Run your driver once with each implementation.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions

Question

1. Identify an organization to analyze, preferably your employer.

Answered: 1 week ago

Question

preference for well defined job functions;

Answered: 1 week ago