Lecture 12

Newitem we will look at insertion and deletion 13 14

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: don’ need the “prev” pointer t anymore. 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 cur 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. Disadvan...
View Full Document

This document was uploaded on 03/31/2014 for the course CS 114 at NJIT.

Ask a homework question - tutors are online