Write and compare two implementations of a priority queue

Assignment Help C/C++ Programming
Reference no: EM132230144

Programming Assignment -

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:

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

2. 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.

Deliverables -

  • A listing of specification and implementation files for both priority queue implementations.
  • A listing of your driver.
  • A listing of your test data.
  • A listing of the output from both runs.
  • A report comparing the number of elements accessed in executing each operation.

Verified Expert

The task of the assignment is to implement the application in minheap and sorted linked list program in c++. The key values are generated using the random number generator. The minheap and linked list are created from the random number and number of swap and comparison for each of the operation is determined and the comparison report is documented with the program.

Reference no: EM132230144

Questions Cloud

Describe a strategy you might use to address the gaps : Post an explanation of how drug policies affect Joe's circumstances, as described in the case study. Then, explain any gaps in service you found in Joe's case.
Why was it important for cartel to have the petrol price : Why was it important for the cartel to have the petrol prices easily visible on boards outside their petrol stations?
Potential expert witnesses made oral agreement : Potential expert witnesses made an oral agreement with a plaintiff’s attorney to testify on behalf of the plaintiff for $60,000.
Qualitative and quantitative analysis : Five recommendations were provided from qualitative and quantitative analysis. Review and discuss a recommendation derived from each method of analysis.
Write and compare two implementations of a priority queue : 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
What are cultural-political-economic-legal environment : what are the cultural, political, economic and legal environment of these countries? Evaluate whether the company chose the right location and why
First order of business is outlining strategic plan : As CEO of the company, your first order of business is outlining a strategic plan for the next 5-years.
How drug policies affect joe circumstances : Post an explanation of how drug policies affect Joe's circumstances, as described in the case study. Then, explain any gaps in service you found in Joe's case.
Do high-voltage power lines cause brain cancer : Do high-voltage power lines cause brain cancer? What about silicone breast implants and breast cancer? Why was it so cold outside yesterday?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  What is a variable

What is a Variable? What kinds or types of Variables are there?

  Which is not a valid name for a method or function

Which is not a valid name for a method or function? Which of the following is a valid overloaded version of this method

  Write the prototype and header for a function

Write the prototype and header for a function called calculate. The function should have three parameters: an int, a reference to a double, and a long (not necessarily in that order). Only the int parameter should have a default argument, which is..

  Define a class for rational numbers

Define a class for rational numbers. A rational number is a number that can be represented as the quotient of two integers. For example, 1/2, 3/4, 64/2, and so forth are all rational numbers.

  Construct a recurrence relation for the number of atoms

The number of atoms of a strange element on Earth per hour is the average of the number of atoms in two previous hours.

  Design your own test program to test the modification.

Add method Modify(int id, char*, char*, float, char*) to modify the id's record. If such id not exist, add it as a new record into the list

  Consider implementing subnetting to support three department

Consider implementing subnetting to support three departments within an organization. The three departments P, Q and R need support for 30, 40 and 60 hosts.

  1 recursive sorts are easier to write in functional style

1 recursive sorts are easier to write in functional style than others. two recursive sorts are quicksort and mergesort.

  How will you do the shrink operation

How will you do the shrink operation and how will you do the expand operation -

  Futures of anomaly based instruction detection scheme

Explain the futures of anomaly based instruction detection scheme.

  Scenario 1: a thief enters your dwelling

Scenario 1: a thief enters your dwelling and steals your computer.is it possible likely that he steals your backup device with backup copies? how do you recover from such an incident?

  Read the matrix from a file called data.txt.

I need to modify this code, instead of asking the user for the matrix, it will read the matrix from a file called Data.txt.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd