Iam_Sandeep

Reverse a doubly linked list

Apr 4th, 2022 (edited)
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.14 KB | None | 0 0
  1.  
  2. def reverseDLL(head):
  3.     pre,cur=None,head
  4.     while cur:
  5.         cur.next,cur.prev,pre,cur=pre,cur.next,cur,cur.next
  6.     return pre
Add Comment
Please, Sign In to add comment