Unformatted text preview: that the component that comes before or after an item has a semantic rela-tionship with that item. For example, a grade list can be a random list of numbers or sorted by value. Figures 9.2 and 9.3 show an unsorted list of grades and a sorted list of grades, respectively. In an array-based implementation, accessing the first item is accessing the list position. In order to move through the items in the list, we need an integer variable that starts at and stops when its value is length . Be careful: Keep in mind that the array goes from index through index MAX_LENGTH – 1 ; the container goes from index through length – 1 . Forgetting this is a common cause for errors in programming. Put item means that given an index, shift the items that follow down one slot in the array and store the item at the index position. Remove the item means that given an index, shift the items that follow up one slot in the array....
View Full Document
This note was uploaded on 01/13/2011 for the course CSE 1550 taught by Professor Marianakant during the Fall '10 term at York University.
- Fall '10