pqueue2.h:
Header file for this version of the PriorityQueue class.
You don't have to write much of this file.
Just copy our version from
pqueue2.h
and add your name and other information at the top.
pqueue2.cxx:
The implementation file for the new
PriorityQueue class. A
version that contains just stubs
is available for you to copy.
pqtest.cxx:
A simple interactive test program. NOTE: This is the test program
from an earlier assignment. You'll need to change the test
program to include pqueue2.h instead of pqueue1.h.
pqexam2.cxx:
A non-interactive test program that will
be used to grade the correctness of your Priority Queue class.
Your PriorityQueue class for this assignment will use a heap that is stored in an array. The component type of the array is called OneItemInfo, and is defined as part of the PriorityQueue class in pqueue2.h. In order for you to further learn how to use private member functions, I would like for you to write and use all the private member functions that are listed in pqueue2.h. The precondition/postcondition contracts for these functions are given in the stub version of pqueue2.cxx.
For easier debugging, carry out this assignment in two parts. Part One
should include everything except the public get_front member function and the
private functions that are needed for get_front (i.e., is_leaf, big_child_index,
and big_child_priority). While you are debugging Part One, you should
add a new option to the interactive test program. The new option makes
this call to print the current state of the tree of the test
PriorityQueue: test.print_tree("STATE OF THE TREE:")
.
(Note that print_tree is a public member function that I wrote for you.
You should remove it before you submit your final work.)
Once Part One is working and tested, you may complete the assignment by implementing the get_front member function and its associated private functions.
Use the interactive test program and the debugger to track down errors in your implementation. If you have an error, do not start making changes until you have identified the cause of the error. If you come to me or a TA for help, we will always ask you to do the following: