程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python Programming for children 6-computer data structures and algorithms

編輯:Python

data structure It is an operation object in the programming problem of non numerical calculation , And the relationship between them and the operation of related issues .

The process of computer processing , In fact, it is the process of processing data , The computer solves a specific The steps to the problem [1]:

(1) To analyze problems , Determine the data model .

(2) Design corresponding algorithm .

(3) Programming , Run and debug the program until you get the correct results .

Programming = data structure + Algorithm

(Program = Data Structure + Algorithm)

data structure (Data Structure) Is the organizational structure of data , To organize 、 Store the data .

Algorithm (Algorithm) It's the way or process to solve the problem .

One 、 Abstract the data structure from the data

To deal with problems, we need to analyze data , And then get the solution to the problem , First, structure the data .

data : It refers to the general term of all media that can be input into the computer and processed by the computer program , It's used for input to an electronic computer for processing , Numbers and letters with a certain meaning 、 Symbol and analog quantity, etc . For example, the characters you have in the game 、 equipment 、 Grade 、 Gold coins, etc. , These are all data , And these data are divided into many different types and stored in the computer .

data elements : It refers to the smallest unit defined by classifying data according to a certain standard , It contains a certain meaning , It can be treated as a whole . Like humans , People are data elements .

Data item : Is a single member item of a data element , That is to say, a data element is composed of several data items . For example, the data element of human , Can have eyes 、 Ears and other data items , You can also have a name 、 Data items such as age .

Multiple related data items form a data element , Many data elements make up a large amount of data .

Data objects : When we process and analyze data , Generally, a limited number of data elements with the same nature will be selected from a large amount of data , Make a collection , As an object of study , be called Data objects . Data objects are of the same nature A collection of finite data elements , It is a subset of data . For example, the upper case data object is a set C={'A','B','C',…,'Z'};1~100 The integer data object of is a set N={1,2,…,100}.

data structure : It refers to the data elements involved and the relationship between them , It can be regarded as a collection of data elements with specific relationships between them .

For example, the ranking of exams , The teacher will make a table in order according to the grades , From first to last , In order . In fact, this is a data structure , It's called a sequence table . The data object is everyone's ranking , Including ranking 、 full name 、 Performance, etc. . Structure is the order of ranking , Everyone has only one front rank and one rear rank ( Except for the first and last place ).

The data structure is logical structure 、 Storage structure ( Physical structure ) And data operations .

Two 、 Logical structure of data structure

Logical structure refers to the relationship between data elements , It is computer independent . There are usually four types of structures :

aggregate : The data elements in the structure belong to the same type , Nothing else .

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

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

Figure structure : There is a many to many relationship between the data elements in the structure . Defines the network relationship .

1. Set structure : There is no relationship between individual data elements ( A box of sugar ).

2. Linear structure : Defines the linear relationship , There is a one-to-one relationship between data elements .( line up )

3. A tree structure : Defines the hierarchical relationship , There is a one to many relationship between data elements .( Members of the family )

4. Graphic structure : Defines the network relationship , Data elements have many to many relationships .( Bus stop )

3、 ... and 、 Storage structure of data structure

That is, how elements are stored , Storage structure is also called physical structure . It is for programmers . Storage structure It is divided into Sequential structure , The chain structure , Index structure , Hash structure .

1. Sequential storage structure : The logical structure between elements is represented by the relative position between data elements

2. Chain storage structure : The logical structure of array elements is represented by the pointers of elements between data elements

3. Hash storage structure : Sequential storage + Calculation column

4. Index storage structure : Sequential storage + Indexes

Logical structure and storage structure diagram :

Four 、 The operation of data [3]

1. The operation of data

It is an operation algorithm defined on the logical structure of data , Such as searching 、 Insert 、 Delete 、 And sorting . for example , For the data structure of higher mathematics grade table , You can do a series of calculations : Add a student record 、 Delete a student record 、 Find the average score of all students 、 The search sequence number is i Student scores, etc .

2. data type

It refers to a set of values with the same properties and some operations defined on this set . Data types can be divided into two categories :

Type of atom : Basic types that can no longer be decomposed , integer 、 Real type 、 Character type, etc .

Structure type : A combination of several types , Can be decomposed again .

5、 ... and 、 Reference material

[1]:https://baijiahao.baidu.com/s?id=1687302279709228125

[2]: data structure : A complete collection of eight data structures _ Green water flows long *z The blog of -CSDN Blog _ data structure

[3]: https://blog.csdn.net/heyuchang666/article/details/49891635


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved