Note: Use linked list created in this blog page: Singly Linked List
public void Reverse()
{
Node current
= this.Head;
Node Next
= null;
Node Prev
= null;
while (current
!= null)
{
Next = current.next;
current.next = Prev;
Prev = current;
current =
Next;
}
this.Head
= Prev;
}
No comments:
Post a Comment