Printing the linked list in reverse order
//The function to print the linked list in reverse order without
//actually reversing it;
//using recursion.
void reversePrint(SinglyLinkedListNode* head)
{
if(head->next!=0)
reversePrint(head->next);
cout<<head->data<<endl;
}
Comments
Post a Comment