Question: What does the following linked list function do at a high level? Node * fun ( Node * head ) { if ( head =

What does the following linked list function do at a high level?
Node * fun(Node * head){
if (head == NULL) return NULL;
if (head->next == NULL) return head;
Node * tmp = head->next;
Node * tmp2= fun(head->next);
tmp->next = head;
head->next = NULL;
return tmp2;
}
What does the following linked list function do at a high level?
Node * fun(Node * head){
if (head == NULL) return NULL;
if (head->next == NULL) return head;
Node * tmp = head->next;
Node * tmp2= fun(head->next);
tmp->next = head;
head->next = NULL;
return tmp2;
}
Deletes all nodes in the list
Reverses a linked list
Swap adjacent pairs of nodes
Moves the first value of the list to the back. All other values stay in their respective order.
Moves the last value of the list to the front. All other values stay in their respective order.
None of the above.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!