Chapter3and4

Chapter3and4 - 4/7/10 13-1 Introduction What will you use...

Info iconThis preview shows pages 1–11. 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

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

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: 4/7/10 13-1 Introduction What will you use as the backing store for your collection types? Array and linked structures have different characteristics It is important to know these characteristics as they affect the performance of the collection using them 4/7/10 23-2 The Array Structure Static array Dynamic array 4/7/10 33-3 Array Characteristics 4/7/10 43-4 Array Operations Traversing Resizing Replacing an element Inserting an element Deleting an element 4/7/10 4/7/10 63-6 Linked Structure Characteristics 4/7/10 73-7 1 package sgray.ch3; 2 3 /** 4 * The structure of a node in the singly linked list 5 */ 6 public class SLNode<E> { 7 private E element; // the data field 8 private SLNode<E> successor; // link to successor 9 10 /** 11 * Create an empty <tt>SLNode</tt> object. 12 */ 13 public SLNode() { 14 this.element = null; 15 this.successor = null; 16 } 17 18 /** 19 * Create an <tt>SLNode</tt> that stores <tt>theElement</tt> and 20 * whose successor is <tt>theSuccessor</tt>. 21 * @param theElement the element to store in this node 22 * @param theSuccessor this nodes successor 23 */ 24 public SLNode( E theElement, SLNode<E> theSuccessor ) { 25 this.element = theElement; 26 this.successor = theSuccessor; 27 } SLNode< The self- referential (recursive) part of the definition 4/7/10 4/7/10 4/7/10 103-10 Let DLNode extend SLNode 1 package gray.adts.ch3; 2 3 /** 4 * The structure of a node in the doubly linked 5 * list. 6 */ 7 public class DLNode<E> extends SLNode<E> { 8 private DLNode<E> predecessor; 9 10 /** 11 * Constructor. Create an empty <tt>DLNode</tt> object....
View Full Document

This document was uploaded on 04/06/2010.

Page1 / 21

Chapter3and4 - 4/7/10 13-1 Introduction What will you use...

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

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