Not to be confused fundamentals of data structures in c horowitz pdf data type. This article needs additional citations for verification.
Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed. In computer science, a data structure is a particular way of organizing and storing data in a computer so that it can be accessed and modified efficiently.
More precisely, a data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data. In comparison, a data structure is a concrete implementation of the specification provided by an ADT. Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks. For example, relational databases commonly use B-tree indexes for data retrieval, while compiler implementations usually use hash tables to look up identifiers.
Data structures provide a means to manage large amounts of data efficiently for uses such as large databases and internet indexing services. Usually, efficient data structures are key to designing efficient algorithms. Some formal design methods and programming languages emphasize data structures, rather than algorithms, as the key organizing factor in software design.
Data structures can be used to organize the storage and retrieval of information stored in both main memory and secondary memory. Data structures are generally based on the ability of a computer to fetch and store data at any place in its memory, specified by a pointer—a bit string, representing a memory address, that can be itself stored in memory and manipulated by the program. The implementation of a data structure usually requires writing a set of procedures that create and manipulate instances of that structure.
The efficiency of a data structure cannot be analyzed separately from those operations. An array is a number of elements in a specific order, typically all of the same type. Arrays may be fixed-length or resizable. The principal advantage of a linked list over an array, is that values can always be efficiently inserted and removed without relocating the rest of the list.
Certain other operations, such as random access to a certain element, are however slower on lists than on arrays. A record is a value that contains other values, typically in fixed number and sequence and typically indexed by names. The elements of records are usually called fields or members. A union is a data structure that specifies which of a number of permitted primitive types may be stored in its instances, e.
Enough space is allocated to contain the widest member datatype. A class is a data structure that contains data fields, like a record, as well as various methods which operate on the contents of the record.
In the context of object-oriented programming, records are known as plain old data structures to distinguish them from classes. On the other hand, many high-level programming languages and some higher-level assembly languages, such as MASM, have special syntax or other built-in support for certain data structures, such as records and arrays. Most programming languages feature some sort of library mechanism that allows data structure implementations to be reused by different programs. Modern languages usually come with standard libraries that implement the most common data structures.