Published online by Cambridge University Press: 05 June 2012
In this and the following chapter, arrays, references and pointers are examined. These will prove essential to a more detailed discussion of objects and classes.
Data structures and arrays
An array constitutes a built-in (e.g. native to the compiler) data structure, which denotes a collection of related quantities with common ordering properties. Each object in an array must be of the same type and is accessible through an integer index. Other commonly occurring data structures include the following.
A bag – an unordered collection of objects.
A set – a bag in which no object can appear more than once.
A list – an object sequence that enables navigation between an object and its successor.
An ordered list – a list with the property that an object can be accessed through its position as well as by way of the neighboring object.
A sorted list – a list with elements stored according to a given ordering operation.
A key set– an object collection that employs a key such as a word or number to locate elements.
A stack – a container for which elements can be added or removed only at the first (top) position; that is, only the last element to be added is accessible at any given time.
A queue – a container constructed such that only the oldest (first) element in the container can be removed at any given time.
To save this book to your Kindle, first ensure no-reply@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.
Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.
Find out more about the Kindle Personal Document Service.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.