Tuesday, 7 October 2014

Reverse of a linked List.

Efficent recursive approarch to find reverse of a linked list.
struct node *reverse(struct node *head)
{
struct node *temp;
if(head->next==NULL)
return head;
temp=reverse(head->next);
head->next->next=head;
head->next=NULL;
return temp;
}

No comments:

Post a Comment