Reverse double linked list :
public void ReverseLinkedList(){
doubleNode current = head;
doubleNode temp = head;
while (current != null)
{
temp = current.prev;
current.prev = current.next;
current.next = temp;
current = current.prev;
}
if (temp != null)
{
head = temp.prev;
}
}
No comments:
Post a Comment