[Dahua Data Structure] Chapter 1-Introduction to Data Structure

Insert picture description here

1. Introduction to data structure

1. Basic concepts

1.1 Data

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

1.2 Data elements

Data element: It is the basic unit that composes the data and has a certain meaning. It is usually processed as a whole in the computer. Also called a record.

1.3 Data items

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

1.4 Data Object

Data object: a collection of data elements of the same nature, and a subset of data.

1.5 Data structure

Structure: Different data elements are not independent, but have specific relationships. We call these relationships structure.

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

2. Logical structure and physical structure

According to different viewpoints, the data structure can be divided into logical structure and physical structure

2.1 Logical structure

Logical structure: refers to the relationship between data elements in a data object.

There are four logical structures:

2.1.1 Collection structure

Collection structure: In addition to the data elements in the collection structure belong to the same collection, there is no other relationship between them.

Insert picture description here

2.1.2 Linear structure

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

Insert picture description here

2.1.3 Tree structure

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

Insert picture description here

2.1.4 Graphic structure

Graphic structure: The data elements of the graphic structure are in a many-to-many relationship.

Insert picture description here

Summary: The logical structure is aimed at specific problems and is to solve a certain problem. Based on the understanding of the problem, a suitable data structure is selected to represent the logical relationship between data elements.

2.2 Physical structure (storage structure)

Physical structure: refers to the storage form of the logical structure of data in the computer.

There are two types of storage structure for data elements: sequential storage and chain storage

2.2.1 Sequential storage structure

Sequential storage structure: The data elements are stored in storage units with consecutive addresses, and the logical and physical relationships between the data are consistent.

Insert picture description here

2.2.2 Chain storage structure

Chain storage structure: It stores data elements in any storage unit. This group of storage units can be continuous or discontinuous.

Insert picture description here

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

3. Abstract data types

3.1 Data type

Data type: refers to a collection of values ​​of the same nature and a general term for some operations defined on this collection.

In C language, according to different values, data types can be divided into two categories:

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

Because different computers have different hardware systems, this requires that the programming language is finally converted into a low-level language through a compiler or interpreter. However, high-level language programmers do not care about what computer the final program runs on. Their purpose is to achieve both. The operation of an integer number, so we consider abstracting operations such as integer operations, real number operations, and character operations.

Abstraction refers to extracting the universal essence of things. It extracts the characteristics of the problem and ignores the non-essential details. It is a generalization of specific things. Abstraction is a way of thinking about problems. It hides complicated details and only retains the information necessary to achieve the goal.

3.2 Abstract data types

Abstract Data Type (ADT): refers to a mathematical model and a set of operations defined on the model. The definition of an abstract data type only depends on its set of logical characteristics, and has nothing to do with how it is represented and implemented inside the computer.

For example, every computer, whether it is a mainframe, a minicomputer, a PC, a tablet, a PDA, or even a smart phone, has an "integer" type and requires operations between integers. Then the integer type is actually an abstract data type, even though it is in The above-mentioned implementation methods may be different in different computers, but due to the same mathematical properties of their definitions, in the eyes of computer programmers, they are all the same. therefore,The meaning of "abstraction" lies in the mathematical abstraction of data types.

In fact,Abstract data type embodies the characteristics of problem decomposition, abstraction and information hiding in program design. The abstract data type decomposes the problems in real life into multiple models that are small and easy to handle, and then establish a data model that can be processed by a computer, and treat the implementation details of each functional module as an independent unit, so as to make the concrete realization The process is hidden.

The standard format for describing abstract data types is given below:

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

4. Summary

Here are two summary diagrams

Insert picture description here

Insert picture description here

Guess you like

Origin blog.csdn.net/m0_50833438/article/details/112797358