This preview shows page 1. Sign up to view the full content.
Unformatted text preview: don’ need the “prev” pointer
newitem We will look at insertion and deletion.
13 14 Deletion:
node *newitem = new node;
newitem data = X;
newitem next = cur;
newitem precede = cur precede;
newitem next precede = newitem;
newitem precede next = newitem;
precede D delete
cur next precede next = cur
next precede = cur 15 Doubly linked lists are usually used with a
dumy head node. If we use a circular doubly
linked list with dummy head, then there are no
special cases for insertion and deletion
necessary. The above code works at the
beginning and end of the list.
View Full Document
This document was uploaded on 03/31/2014 for the course CS 114 at NJIT.
- Spring '09
- Assembly Language