5,444 views
0 votes
0 votes

What does the following function do for a given Linked List with first node as head?

void fun1(struct node* head)
{
  if(head == NULL)
    return;
   
  fun1(head->next);
  printf("%d  ", head->data);
}
will it print 5-4-3-2-1 or 4-3-2-1 if i/p is 1-2-3-4-5?Will the last 5 get printed or not , due to return;
 

1 Answer

Related questions

0 votes
0 votes
1 answer
1
Mrityudoot asked Feb 25
179 views
How can we find the highest element in a singly linked list in O(1)? We are free to use any extra space.