Singly linked list reversal core code

1. Data structures and algorithms must be drawing to think step by step, to achieve the following core code

Node prev = null;
while(head.next != null)
{
    Node temp = head;
    head->next = prev;
    prev = head;
    head = temp->next;
}

Guess you like

Origin blog.csdn.net/wangping623/article/details/93723176