public void add (Object to_Add) {
if (isEmpty ( )) {
myHead = new DListNode (to_Add);
} else {
// Insert to_Add between myHead and myHead.myPrev.
DListNode newNode = new DListNode (to_Add, myHead.myPrev, myHead);
// Link the new node into the list.
myHead.myPrev.myNext = newNode; // This is the circular link stuff.
myHead.myPrev = newNode;
}
mySize++;
}
Monday, November 19, 2007
Adding to a Circular Doubly Linked List
Subscribe to:
Post Comments (Atom)
Just some daily notes ...
Things I'm into now...
Blog Archive
-
▼
2007
(29)
-
▼
November
(14)
- Declaring an Edge Adjacency List Graph
- MaximallyBalanced or Complete Binary Tree
- Calculating the Height of a Tree
- Adding to a Circular Doubly Linked List
- 3 ways to REVERSE a list (singly linked)
- Reversing a List Iteratively!
- Doubling a Linked List
- Access Modifiers: public, private, proctecd, packa...
- End of HFJ
- Format Specifiers
- Collection class tidbits...
- Generic class definitions and one implementation
- doubling a List
- Don't Forget Your Scheme!
-
▼
November
(14)

No comments:
Post a Comment