Singly linked list in reverse output

The single list in reverse output, there are several ideas.
For example: the output of the single chain reverse; singly-linked lists or sequentially traverse the stack is then deposited, and then the stack is achieved; or is recursive.

One can imagine that recursion is the simplest method. Therefore, the following in a single linked list node lead, for example, put the code Recursive:

void reverse(LinkList L)
{
if(L->next!=NULL)
{
reverse(L->next);
}
print(L->data);
}

Guess you like

Origin www.cnblogs.com/h694879357/p/11708724.html