lists_are_equal() that
returns true if two linked lists are equal, and false otherwise.
/cs/cs2005/labs/lab4 to your directory using this command:
cp /cs/cs2005/labs/lab4/* .
lists_are_equal() in node1.h:
bool lists_are_equal(node* head1, node* head2);What does it mean for two lists to be equal? We will define equality to mean that
lists_are_equal() and put your solution
in node1.cxx (you will find a stub for the function at the end of node1.cxx). Your solution must be recursive.
You should define the base cases first (the cases that will stop the
recursive calls and return true or false to the calling function).
What are the base cases for lists_are_equal()? There are three of them:
Once you have written the function, use make
to
compile the test program
linktest. Run the test program to see if your function works correctly.
node1.cxx.
The command you should use to turnin your file is:
/cs/bin/turnin submit cs2005 lab4 node1.cxx