Lab 3 will provide you additional opportunity to work with linked lists. You are to implement a priority queue of integers via a sorted linked list (smallest to highest). Thus, for this assignment, the smallest integer has the "highest priority". The operations you are to implement include:
Download the lab3.zip file from the 15-113 course web site. Save the zip file to your temp directory and unzip the files. You should see the following files:
Remember that all member function definitions in the .cpp file must be prefaced with PQueue:: to resolve the scope of the function correctly. Also note that operator<< is a friend, not a member function. Thus, if you need to declare a Node* inside the definition of operator<<, you'll have to resolve it with PQueue:: as well (i.e., PQueue::Node* p).
You can implement Insert either iteratively or recursively. It will probably be easier to define a private helper function if you choose to implement the Insert recursively. Remember also the general form of the copy constructor:
{ initialize private data as the default constructor would *this = pq; }
And the general form of the assignment operator:
{ if (this != &rhs) { MakeEmpty(); //no memory leak here! //Initialize self if MakeEmpty() didn't //Explicitly copy into new memory all of rhs's data } return *this; }
You should make no changes to pq-test.cpp (other than to remove the comments to test the assignment operator and copy constructor once you've implemented them). You will not need to run this in a DOS window as we are not using a command-line interface.
Your Solution zip file must contain (only) the following files
Use the Intro Programming dropoff form to submit your zip file.