Notes 3 - Week 2: Array Based Lists We will implement the...

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

View Full Document Right Arrow Icon
Week 2: Array Based Lists We will implement the list interface using arrays in this chapter, then using linked lists in the next chapter. We will do this without using the existing Java Vector class or the ArrayList class. Task 1: To get an informal idea study Fig. 5-1 on page 128. Then answer questions #1, 2 and 3 on page 130. This is just one of many possible ways to interpret an array implementation. This particular version uses shifting . Other textbooks have other variations such as leaving spaces with a special (null) value. Notice that the single-parameter add method is InsertTail and the two-parameter version adds to any given position. Our textbook does not implement a separate InsertHead. Task 2: Review the implementations in section 5.5 pages 130-132. Data for the array based list: private object[] entry; private int length; private static final int MAX_SIZE = 50; So the name of the array is entry and entry.length is the declared length of the array. The variable above, also called length , is the number of elements actually used. When the number actually used is equal to the declared length, then the array is full.
Background image of page 1

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

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

This note was uploaded on 01/23/2012 for the course CS 111C taught by Professor Metzler during the Spring '11 term at City College of San Francisco.

Page1 / 3

Notes 3 - Week 2: Array Based Lists We will implement the...

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

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