8.4 Lists
Lists occur as naturally in programming as they do in real life. We manipulate guest lists, grocery lists, class lists, and things-to-do lists. The list of lists is endless. Three properties characterize lists: The items are homogeneous, the items are linear, and lists have varying lengths. By linear, we mean that each item except the first has a unique component that comes before it, and each item except the last has a unique component that comes after it. For example, if there are at least three items in a list, the second item comes after the first and before the third.
Whereas stacks and queues have all the semantics in the deletion operation, lists usually provide operations to insert an item (Insert), delete an item (Delete ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access