Data Structure Linked list Question: Download Questions PDF
Do you know what does the following function do for a given Linked List?
![Linked list Interview Answer Linked list Interview Question](https://globalguideline.com/public/images/interview/12.png)
Answer:
void fun1(struct node* head)
{
if(head == NULL)
return;
fun1(head->next);
printf("%d ", head->data);
}
fun1() prints the given Linked List in reverse manner. For Linked List 1->2->3->4->5, fun1() prints 5->4->3->2->1.
{
if(head == NULL)
return;
fun1(head->next);
printf("%d ", head->data);
}
fun1() prints the given Linked List in reverse manner. For Linked List 1->2->3->4->5, fun1() prints 5->4->3->2->1.
Download Linked list Interview Questions And Answers
PDF
Previous Question | Next Question |
By using C++ with an example describe linked list? | Tell me how to find middle element of linked list in one pass? |