Question: please also explain thanks !! Write a recursive function named equals, which accepts two Node pointers, each pointing to a linked list, and returns a
please also explain thanks !!
Write a recursive function named equals, which accepts two Node pointers, each pointing to a linked list, and returns a bool. The function returns true if the two linked lists have identical sequences of values (i.e., they have the same number of nodes, and corresponding nodes of each list have the same value) and false otherwise. Two empty lists are identical. You will receive a score of zero on this problem if the body of your compare function is more than 12 statements long or if it contains any occurrence of the keywords while, for, or goto. Here's how your function might be called: int main() Node* hl; Node* h2; ... // Assume this omitted code sets hi to point to // the first node in a list whose nodes have the // values 1 2 3, and sets h2 to point to another 1/ such list. if (equals (h1, h2)) 11 true in this example cout
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
