Data Structures:All Chapters

From Wikibooks, the open-content textbooks collection
Computers can and usually store and process vast amounts of data. Some of this data is of use in limited ways (such as the company's name, the date, etc) while most application data follows some pattern. For example, student records at a university would typically contain an id-number, names, addresses, contact details, course information, etc. For conceptual and data processing efficiency reasons this vast amount of data should be structured. That is, the same sort of data, in our student records example, would be provided for each student. Within the one application there would typically be many of such data structures created. Also typically there would be some conceptual relationships which link data structures.
There are no hard and fast rules as to how data must be structured. The structures which are adopted will be determined by the purpose to be achieved. Sometimes the structure of the software may be a relevant consideration, as well as the amount of data involved.
The objective is, ultimately, to process the data captured or stored on the computer in the most efficient manner.
Formal data structures enable a programmer to mentally structure the large amounts of data into conceptually manageable relationships.
Sometimes we use data structures to allow us to do more: for example, to accomplish fast searching or sorting of data. Other times, we use data structures so that we can do less: for example, the concept of the stack is a limited form of a more general data structure. These limitations provide us with guarantees that allow us to reason about our programs more easily. Data structures also provide guarantees about algorithmic complexity — choosing an appropriate data structure for a job is crucial for writing good software.
Because data structures are higher-level abstractions, they present to us operations on groups of data, such as adding an item to a list, or looking up the highest-priority item in a queue. When a data structure provides operations, we can call the data structure an abstract data type (sometimes abbreviated as ADT). Abstract data types can minimize dependencies in your code, which is important when your code needs to be changed. Because you are abstracted away from lower-level details, some of the higher-level commonalities one data structure shares with a different data structure can be used to replace one with the other.
Our programming languages come equipped with a set of built-in types, such as integers and floating-point numbers, that allow us to work with data objects for which the machine's processor has native support. These built-in types are abstractions of what the processor actually provides because built-in types hide details both about their execution and limitations.