Dale - Computer Science Illuminated 306

Dale - Computer Science Illuminated 306 - A linked...

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

View Full Document Right Arrow Icon
Linked implementation An implementation of a container where the items are stored together with information on where the next item can be found 9.2 Implementation 279 Figure 9.2 An unsorted list of integers length [0] 66 0 75 95 80 65 90 [1] [2] [3] [4] [5] [MAX_LENGTH 1] list Figure 9.3 A sorted list of integers length [0] 66 0 65 75 80 90 95 [1] [2] [3] [4] [5] [MAX_LENGTH 1] list Get next item means to increment the value used as an index and access that indexed position. More items means that the variable used as an index is less than length ± 1 . Linked Implementation
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: A linked implementation is based on the concept of a node . A node is made up of two pieces of data: the item that the user wants in the list and a pointer to the next node in the list. A pointer to the first node in a list is saved in a named variable, called the external pointer to the container (list). The pointer variable of the last node in the list contains a symbol that means the end of the list, usually null . Figure 9.4 shows the anatomy of a linked list....
View Full Document

Ask a homework question - tutors are online