cache-low-level-system-design icon indicating copy to clipboard operation
cache-low-level-system-design copied to clipboard

DoublyLinkedList.java

Open VipulGupta09 opened this issue 4 years ago • 0 comments

In class DoublyLinkedList, the method detachNode(), Here we need to check the node that we are deleting having prev and next not null as: case 1 : if(node.prev!=null){ node.prev.next = node.next; }else{ dummyHead = node.next; // if the node is head then we need to move the head . } case 2 : if(node.next!=null){ node.next.prev = node.prev; }else{ dummyTail = node.prev; // if the node is tail then we need to move the tail. }

VipulGupta09 avatar Apr 27 '21 19:04 VipulGupta09