Lecture14RemoveInsert

Lecture14RemoveInsert - remove() method for the Linked List...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: remove() method for the Linked List class This remove method goes with a LinkedList class (not the inner LinkedListIterator class) public void remove (Object x) { Node current = first; Node previous = null; . remove() method for LinkedList public void remove (Object x) { Node current = first; Node previous = null; while(current != null && !current.data.equals(x) ) { previous = current; current = current.next; } } remove() method for LinkedList public void remove (Object x) { Node current = first; Node previous = null; while(current != null && !current.data.equals(x) ) { previous = current; current = current.next; } if (current != null) { if (current == first) { first = first.next; } } } remove() method for LinkedList public void remove (Object x) { Node current = first; Node previous = null; while(current != null && !current.data.equals(x) ) { previous = current; current = current.next; if (current != null) { if (current == first) { first = first.next; } else { previous.next = current.next; } } } remove() method for LinkedList...
View Full Document

This note was uploaded on 10/13/2008 for the course CSC 216 taught by Professor Miller during the Spring '08 term at N.C. State.

Page1 / 9

Lecture14RemoveInsert - remove() method for the Linked List...

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

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