Friday, July 4, 2014

Display linked list from the end

Pseudo code:

1) Recursively call Display_from_end API till you get the end of the linked list.
2) Once you get the linked list print the node.

void Display_from_end(struct linkedlist *head)
{
    if(head == NULL)
    return;
   Display_from_end(head->next);
   printf("%d",head->data);

}

Ex:
Linked List L : 1 -> 2 -> 3 -> 4



No comments:

Post a Comment