Day21 - COP 3503 Computer Science II CLASS NOTES DAY#21 Doubly Linked Lists Better than singly linked list as they are bi-directional Has both a

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
COP 3503 – Computer Science II CLASS NOTES - DAY #21 Doubly Linked Lists Better than singly linked list as they are bi-directional. Has both a header and a tail node (for the same reason that we added the header node to the singly linked list). null null header tail public class DLLNode { public Object data; public DLLNode next; public DLLNode prev; private DLLNode ( ) { } //defeats improper instantiation public DLLNode (Object x) //constructor for isolated DLLNode { data = x; // prev = null; // next = null; // null } //end constructor public DLLNode (Object x, DLLNode n, DDLNode p) //constructor for linked DLLNode { data = x; next = n; prev = p; } //end constructor } //end class DLLNode p n Day 21 - 1 A B prev data = x next null x
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Doubly Linked List Implementation in Java public class Doubly_Linked_List { protected DLLNode header; protected DLLNode tail; protected DLLNode current; public Doubly_Linked_List ( ) { header = new DLLNode(null); tail = new DLLNode(null); header.next = tail; tail.prev = header; } // end constructor public void resetList ( ) { header.next = tail; tail.prev = header; current = header; } //end resetList
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/22/2009 for the course COP 3503c taught by Professor Staff during the Spring '08 term at University of Central Florida.

Page1 / 6

Day21 - COP 3503 Computer Science II CLASS NOTES DAY#21 Doubly Linked Lists Better than singly linked list as they are bi-directional Has both a

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online