Introduction to Data Structure for Data Structure Learning



foreword

  "Big Data Structure" is a book written by Mr. Cheng Jie. The author will follow this book written by Mr. Cheng Jie to record his data structure learning journey.


1. What is a data structure

  Data structure is a subject that studies the operating objects in non-numerical computing programming problems, as well as their relationship and operations and other related issues.

  In my understanding, the data structure is the relationship between data and the relationship between data. To study the logical relationship between them, different environments use different logic to send, receive, store, etc. the data, and strive for an optimal solution.

2. Basic concepts and terminology

2.1. Data

  Data: It is a symbol that objectively describes things, an object that can be manipulated in a computer, and a collection of symbols that can be recognized by a computer and input to the computer for processing. The data includes not only numerical types such as integers and real types, but also non-numeric types such as characters, sounds, images, and videos.

2.2. Data elements

  Data element: A basic unit that makes up data and has a certain meaning. It is usually treated as a whole in a computer, and is also called a record.

2.3. Data items

  Data item: A data element can consist of several data items.
  A data item is the smallest unit of indivisible data.

2.4, data object

  Data object: It is a collection of elements with the same nature, and it is a subset of data.

2.5. Data structure

  Data structure: It is a collection of data elements that have one or more specific relationships among each other.

  It can be seen from the definition that a data item is the smallest unit, and a data item constitutes a data element, and data elements with the same nature are called data objects, and a data structure is a collection of data elements.

3. Logical structure and physical structure

3.1. Logical structure

  Logical structure refers to the relationship between data elements in a data object, which can be divided into the following four types:

    1) Collection structure: Except that the data elements in the structure belong to the same collection, there is no other relationship between them. Individual data elements are "equal". Set relationships in data structures are similar to sets in mathematics.

    2) Linear structure: There is a one-to-one relationship between data elements in the linear structure.

    3) Tree structure: There is a one-to-many hierarchical relationship between data elements in the tree structure.

    4) Graphical structure: The data elements of the graphical structure are in a many-to-many relationship.

  To sum up, the logical structure is to solve a certain problem. On the basis of understanding the problem, choose an appropriate data structure to represent the logical relationship between data elements.

3.2. Physical structure

  Physical structure: refers to the storage form of the logical structure of data in the computer, mainly sequential storage and chain storage.

    1) Sequential storage structure: data elements are stored in storage units with continuous addresses, and the logical and physical relationships between the data are consistent. (like an array)

    2) Chained storage structure: Eighteen data elements are stored in any storage unit, and then the address of the associated data element is stored through the pointer, and the associated data element is found through the address. This group of storage units can be continuous or not continuously. (like a linked list)

  The logical structure is problem-oriented, while the physical structure is computer-oriented, and its basic goal is to store data and its logical relationship in the computer's slave memory.

4. Abstract data type

4.1, data type

  Data type refers to the general term for a set of values ​​with the same properties and some operations defined on this set. In C language, data types can be divided into two categories according to different values:

    1) Atomic type: It is a basic type that cannot be decomposed, including integer, real, character, etc.
    2) Structural type: It is composed of several types and can be decomposed. For example, an integer array is composed of several integer data.

4.2. Abstract data type

  An abstract data type refers to a mathematical model and a set of operations defined on the model. The definition of an abstract data type depends only on his set of logical characteristics, and has nothing to do with how it is represented and implemented in computing and internally. For example, PCs, tablets, mobile phones, etc. all have "integer" types that also require integer operations, so plastic is an abstract data type. Although it may be implemented in different ways in the above-mentioned computers, due to its The mathematical properties are the same, and from the computer's point of view, they are the same. Therefore, the meaning of "abstract" lies in the mathematical abstract properties of the data type.

  Abstract data types not only refer to those data types that have been defined and implemented, but also data types defined by computer programmers when designing programs, such as coordinate systems. We can define an abstract data type of point, which has x, y ,z are three integer variables, so that we can easily know the coordinates of this point by operating the point data variable.

  According to the definition of an abstract data type, it also includes a set of operations defined on this model. For example, in the game, we define several basic operations: walking (forward, backward, up, down), jumping, hitting bullets, etc. An abstract data type defines: a data object, the relationship between data elements in the data object, and the operations on the data elements. As for what operations an abstract data type needs, it only needs to be determined by the designer according to the actual situation.

  In fact, abstract data types embody the characteristics of problem decomposition, abstraction, and information hiding in programming. The abstract data type decomposes the problems in real life into multiple small-scale and easy-to-handle problems, and then builds a data model that can be processed by a computer, and treats the implementation details of each functional module as an independent unit, so that the specific implementation The process is hidden.

  The standard format for abstract data types:

ADT  抽象数据类型名
Data
	数据元素之间逻辑关系的定义
Operation
	操作1
		初始条件
		操作结果描述
	操作2
		...
	操作n
		...
endADT


Summarize

  A data structure is a collection of data elements that have one or more specific relationships with each other. Discussions from different angles will have different classifications. For example, according to the logical structure, there are set structure, linear structure, tree structure and graph structure; The classification of physical structure includes sequential storage structure and linked storage structure. Finally, we have a brief understanding of data types, the definition of abstract data types and its description methods, laying the foundation for future courses.

Guess you like

Origin blog.csdn.net/code_lyb/article/details/130092164