The basic concept of data structure
Whether we are students of computer major or program ape who have been working / Yuan , I can't get around it data structure This technology point , Let's talk about it today .
1. What data structures are learning
- How to use program code to solve real world problems Promotion of information technology
- how Use a computer to process efficiently This information creates value
The development of human society , So far, it has experienced and experienced three waves ： The first wave was agriculture , From about 1 Ten thousand years ago ; The second wave is the industrial stage , from 17 At the end of the century ; The third wave is the coming information stage . ----《 The third wave （1980 edition ）》, alvin · Toffler
An example of informatization ：
All these above , It has covered all aspects of our daily life .
The only thing that's certain , Tomorrow will surprise all of us .
—— alvin · Toffler
2. Some basic concepts of data structure
1） Basic concepts
data Is the carrier of information , It's a number that describes the attributes of an objective thing 、 A collection of characters and all symbols that can be input into a computer and recognized and processed by a computer program . Data is the raw material for computer programming .
What the computer can recognize is 0 and 1 Binary number of .
data elements 、 Data item ：
data elements It's the basic unit of data , Usually considered and dealt with as a whole .
A data element can be made up of several Data item form , Data item Is the smallest indivisible unit of data elements .
The relationship between the elements .
data structure 、 Data objects
data structure ： It's that there's one or more specific things that exist between each other Relationship A collection of data elements of .
Data objects ： Yes. Same nature A collection of data elements of , It's a subset of the data .
An example of fishing up to the bottom of the sea ：
data structure ： Queuing customer information for a particular store and the relationship between them
Data objects ： Queuing customer information for all stores across the country
Here is a diagram to show the relationship between these concepts ：
data type Is a collection of values and a set of operations defined on this set .
- Type of atom ： A data type whose value cannot be subdivided .
- Structure type ： Its value can be further decomposed into several components （ component ） Data type of .
Abstract data types (ADT)
Abstract data type is the organization of abstract data and its related operations .
2） The three elements of data structure
The logical relationship between data elements .
Each element belongs to a set , Nothing else .
There is a one-to-one relationship between data elements , Except for the first element , All elements have a unique Forerunner ; Except for the last element , All elements have a unique The subsequent .
A tree structure
There is a one to many relationship between data elements .
The graph structure
There is a many to many relationship between data elements .
Physical structure （ Storage structure ）
A computer represents the structure of logical relationships between data elements .
Store logically adjacent elements in a physical location that is also adjacent to each other , The relationship between elements is represented by the adjacency of storage units .
Logically adjacent elements may not be adjacent in physical position , The logical relationship between elements is represented by a pointer indicating the storage address of the element .
While storing element information , Also create additional index tables . Each item in an index table is called an index entry , The general form of an index entry is （ keyword , Address ）.
According to the key words of the element, the storage address of the element can be calculated directly , Also known as hash （Hash） Storage .
The method of calculating hash value will be introduced later
Another wave of understanding , Blossom
1） If sequential storage is used , Each data element must be physically continuous ; If non sequential storage is used , Then each data element can be physically discrete .
2） The storage structure of data will affect the convenience of storage space allocation .（ such as , Someone wants to jump in line ）
3） The storage structure of data will affect the speed of data operation .（ such as , Trying to find someone ）
The operation of data
The operations imposed on the data include Definition and Realization . Definition of operation It's about logical structure , Point out the function of operation ; The realization of computation It's about the storage structure , Point out the operation steps .
I'll learn the specific data structure types later , You'll learn to define and implement .
If you want to know more , You can pay attention to the official account of WeChat ： Programmers should be like this , Get more quality content .