Data structure is a form of organization that can be used to characterize specific object data. In computer programming, the object of operation is a variety of data, which often have different data structures, such as arrays, interfaces, classes, etc. and the algorithm and data structure are inextricably linked, computer scientist Nickeraus Worth (Nikiklaus Wirth) proposed "data structure + algorithm = Program" the famous formula. This is because different data structures adopt different processing methods, computational complexity is different, so the algorithm is often dependent on a data structure, that is, the data structure is the basis for the implementation of the algorithm.
The data structure is a kind of storage and organization method of computer, and it also refers to the with one or more specific relationships among each other. Data structure is an embodiment of computer art, reasonable data structure can improve the efficiency of the implementation of the algorithm, but also improve the storage efficiency.
Data structure is the product of computer program design, in fact, until now, there is no unified data structure definition in the field of computer technology. Different experts tend to have different descriptions of data structures, and here are a few typical definitions.
"A data structure is a variety of relationships between an object, an instance that exists in that object, and the elements that make up an instance, and this relationship can be given by defining the related function." "This is Sartaj Sahni in his classic book, data structure, algorithms and applications," he defined the data object as a collection of instances or values.
The data structure is the physical implementation of the abstract data type ADT. "This is Clifford A.shaffer in its" data structure, algorithms and applications "in the definition of the book. of which the abstract data type ADT, English full name abstract data type, referred to as ADT. The concept of an abstract data type ADT We'll talk about later.
Lobertl.kruse also gives the concept of data structure design process, he thinks that the design process can be divided into abstract layer, data structure layer and reality layer. Abstract layer refers to the abstract data type layer, which is the ADT layer, mainly discusses the logical structure of data and its operation; the data structure layer discusses the representation of a data structure, and the implementation layer discusses the storage details of a data structure in the computer and the implementation of the operation.
Although the industry does not have a unified definition, these definitions all have the same meaning. We just need to understand the basic definition of the data structure and be able to use it to solve the problem. We can simply understand data structures, a data structure is organized by the elements of a logical connection, the description of the logical relationship between data elements is called the logical structure of the data. Since the data must be stored in the computer, the storage structure of the data is the representation within its computer, that is, the realization form of the structure. In addition, the discussion of a data structure must involve operations performed on that type of data.
Data structure is the basis of all algorithms, and not only that, data structure can be said to be the basis of programming language. It is because of the deep understanding of data structure that it leads to the birth of a variety of programming languages, such as Java, C + +, C #, etc. The object-oriented programming language is an example of perfecting the object type data structure, which can describe and solve practical problems conveniently in some aspects.
Basic concepts in the data structure
Before we dive into the data structure, we need to grasp briefly some of the basic concepts involved in the data structure, including the following:
Data: Data is the carrier of information, it can be computer identification, storage and processing, is the computer program processing "raw materials." Data includes a wide range of types, such as basic shaping, characters, strings, real numbers, and so on, and images and sounds can also be considered as data.
Data element: The data element is the basic unit of data, which is also called elements, nodes, vertices, records, and so on. In general, a data element can consist of several data items, which are the smallest identifying units with independent meanings. Data items can also be called fields, domains, properties, and so on.
Data structure (data Structure): The structure refers to the relationship between the information, that is, the organization of data.
The contents of the data structure
data structure includes three aspects of the content, the logical structure, data storage structure and data operation. The following will analyze the three aspects of the content.
Logical Structure of data (Logical Structure): The logical relationship between data elements. The logical structure of data is to describe data structures from a logical relationship, and it is independent of how it is stored in the computer, that is, abstract concepts that are separate from the computer. From the point of view of mathematical analysis, the logical structure of data can be regarded as a mathematical model abstracted from concrete problems.
The storage structure of the data (Storage Structure): That is, the data element and its logical relationship in the computer memory representation. The storage structure of the data depends on the computer language and is the implementation of the logical structure for the computer language. Generally speaking, the storage structure is only discussed at the level of the high-level language, in the low-level machine language, the storage structure is specific.
The operation of the data: that is, the manipulation that can be applied to the data. Data is based on the logical structure of the data, each logical structure can be summed up a set of operations. In the data structure category, the most commonly used operations include retrieving, inserting, deleting, updating, sorting and so on.
In fact, the logical structure of data, the storage structure of data and the operation of data is a whole, independent to understand that any one of these three is not comprehensive. This is mainly manifested in the following aspects.
-the same logical structure can have different storage structures.
The logical structure and storage structure are two concepts, the same logical structure can be composed of different storage structures. For example, the linear table is the simplest logical structure, if the linear table is stored sequentially, this data structure is the sequential table, if the linear table is stored in a chained way, this data structure is linked list, if the linear table is hashed, this data structure is a hash table.
-the same logical structure can have different sets of data operations.
The operation of data is a very important content in the structure. An identical data logical structure and storage structure, and the use of different operation sets and operation properties will result in a new data structure. For example, a linear table, if the insertion operation of the linear table is limited to a section of the table, and the deletion is restricted to the other end of the table, then this data structure is the queue, if the linear table insert and delete operations are restricted to the same segment of the table, then this data structure is the stack.
These three aspects of the data structure are an organic whole, indispensable. The logical structure of data, the storage structure of data and the operation of data any change will result in a completely new data structure.
"Reproduced use, please specify the source:http://blog.csdn.net/mahoking"
"Reproduced use, please specify the source:http://blog.csdn.net/mahoking"
"Algorithm Notes" data structure (i)