Question: 4. Linked Lists, Recursion (10%) Consider the following C++ code. What linked list is returned if funcA is called with the input linked list 1,2,3,4,5?
4. Linked Lists, Recursion (10%) Consider the following C++ code. What linked list is returned if funcA is called with the input linked list 1,2,3,4,5? All of the points for this problem will be assigned based on your explanation, since we have full faith in your ability to run this program and copy down the answer. We strongly recommend solving this by hand, and only using a compiler to verify your answer. struct Node { int value; Node wnext; }; void funcB (Node# ini, Node* in2); Node* funcA (Nodex in) { if (in - NULL) return NULL; Node* out = NULL; if (in->next = NULL) out = funcA (in->next); funcB (in, out); in->next = NULL; return out; } return in; void funcB (Node* ini, Nodex in2) if (in2->next = NULL) funco (ini, in2->next); return; } in2->next = inl
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
