From "C Program Design" (Jiang Cofen Cao, Tsinghua University Press)
Data
A set of symbols that can be entered into a computer and processed by a computer for the symbolic representation of an objective thing.
Data elements
The basic unit of data, which is considered and processed within the computer as a whole.
Data item
A data element can consist of several data items, which are the smallest units of data that are inseparable, also known as fields or domains.
Data Objects
A collection of data elements of the same nature, which is a subset of the data.
Data
A collection of data elements that exist in one or more specific relationships with each other. Contains
- Logical structure of data (relationship between data elements)
- The storage structure of the data (the representation of the data elements and their relationships in the computer)
- Operation of the data (operation of the data)
Three aspects of the content.
Class 4 Logical Structure
- Collection: There is no other relationship between the data elements in the structure, except the relationship belonging to one collection.
- Linear structure: There is a relationship between the data elements in the structure.
- Tree structure: There is a multiple relationship between the data elements in the structure.
- Graphical structure or mesh structure: there is a one-to-many or many-to-many relationship between the data elements in the structure. The linear structure is a special case of the tree structure, and the tree structure is the special case of the graphic structure.
The tree structure and the graphic structure are collectively referred to as nonlinear structures.
4 commonly used storage structures
- Sequential storage structure: the logically adjacent elements are stored in a physically adjacent storage unit, and the logical relationship between elements is directly reflected by the adjacency relation of the storage space. The advantage is to save storage space, the disadvantage is not easy to insert and delete elements.
- Chained storage structure: Logically adjacent elements do not require physical proximity, and the logical relationships between elements are represented by additional pointer fields. The main advantage is that it is easy to insert and delete operations, with the disadvantage of requiring additional pointer space and not having random access to elements.
- Index storage structure: an additional index table is created while storing the element information, and the index table consists of a keyword and a pointer to the element. This structure greatly improves the speed of data lookup, it can be random access to the elements, in the insertion, delete the operation is very fast. The disadvantage is that additional space is required to store the index table.
- Hash storage structure: Calculates the position of an element from a hash function based on a keyword, with the advantage of finding fast and suitable for quickly locating and inserting elements. This structure stores only the elements ' data, and does not store the logical relationships between the elements.
Abstract data Type ADT
ADT abstract data type name {
Data objects: Definition of Data Objects
Data relations: Definitions of data relationships
Basic operations: The definition of basic operations
}adt abstract Data type name
Where the basic operation is defined in the following format:
Basic operation name (parameter table) initial conditions: describing initial conditions
Operation Result: Describe operation function and operation result
Wikipedia
In computer science, a data structure is a particular the organizing data in a computer so it can be used Efficien tly. Data structures can implement one or more particular abstract data types (ADT), which specify the operations that can is P Erformed on a data structure and the computational complexity of those operations. In comparison, a data structure are a concrete implementation of the specification provided by an ADT.
Different kinds of data structures is suited to Different kinds of applications, and some is highly specialized to speci FIC tasks. For example, relational databases commonly with B-tree indexes for data retrieval, while compiler implementations usually u SE 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 intern ET indexing services. Usually, efficient data structures is key to designing efficient algorithms. Some formal design methods and programming languages emphasize data structures, rather than algorithms, as the key Organiz ing factor in software design. Data structures can used to organize the storage and retrieval of information stored in both main memory and in Seconda Ry memory.
Data structures is generally based on the ability of a computer to fetch and store Data at any place in its memory, SP Ecified by a pointer-a bit string, representing a memory address, that can is itself stored in memory and manipulated by T He program. Thus, the array and record data structures is based on computing the addresses of data items with arithmetic operations; While the linked data structures is based on storing addresses of data items within the structure itself. Many data structures use both principles, sometimes combined in non-trivial ways (as in XOR linking).
The implementation of a data structure usually requires writing a set of procedures that create and manipulate instances O F that structure. The efficiency of a data structure cannot is analyzed separately from those operations. This observation motivates the theoretical concept of an abstract data type, a data structure which is defined indirectly B Y the operations is performed on it, and the mathematical properties of those operations (including their space a nd time cost).
In computer science, an abstract data type (ADT) is a mathematical model for data types where a data type is defined by it s behavior (semantics) from the point of view of a user of the data, specifically in terms of possible values, possible op Erations on data of this type, and the behavior of these operations. This contrasts with data structures, which is concrete representations of data, and is the point of view of the implement Er, not a user.
Formally, an ADT defined as a "class of objects whose logical behavior are defined by a set of values and a set of O Perations "; This was analogous to a algebraic structure in mathematics. What's meant by ' behavior ' varies by author, with the both main types of formal specifications for behavior being Axiomati C (algebraic) specification and an abstract model; These correspond to axiomatic semantics and operational semantics of a abstract machine, respectively. Some authors also include the computational complexity ("cost"), both in terms of time (for computing operations) and SPAC E (for representing values).
In practice many common data types was not ADTs, as the abstraction was not perfect, and users must being aware of issues like Arithmetic overflow that is due to the representation. For example, integers is often stored as fixed width values (32-bit or 64-bit binary numbers), and thus experience intege R overflow If the maximum value is exceeded.
ADTs is a theoretical concept in computer science, used in the design and analysis of algorithms, data structures, and so Ftware systems, and does not correspond to specific features of computer Languages-mainstream computer languages does not dire ctly support formally specified ADTs. However, various language features correspond to certain aspects of ADTs, and is easily confused with ADTs proper; These include abstract types, opaque data types, protocols, and design by contract. ADTs were first proposed by Barbara Liskov and Stephen N. Zilles in 1974, as part of the development of the CLU.
Some Common ADTs, which has proved useful in a great variety of applications, is
- Container
- List
- Set
- Multiset
- Map
- Multimap
- Graph
- Stack
- Queue
- Priority queue
- double-ended queue
- Double-ended Priority Queue
Basic concepts of data structure