This article mainly introduces the theory related to data types, and this article does not involve code.
Table of contents
Logical Structure & Physical Structure
Data Structure Origin
A long time ago, computers were used to process numerical calculations. Data is the processing object of the program. Data elements are the basic units that make up data. Data objects are collections of data elements with the same nature. Data elements are not independent and have specific characteristics. relationships, and these relationships are structures.
Data structure is a subject that studies the operating objects in the programming problems of non-numerical calculations, as well as the relationship and operation between them and other related issues
In 1968, American Professor Don Ocknu created the initial system of "data structure". His Computer Programming Skills Volume 1 Basic Algorithm is the first book that systematically expounds the logical structure and storage structure of data and its operation. , from the late 1960s to the early 1970s, large-scale programs appeared, and the software was relatively independent. Structured programming became the main content of programming methodology. People pay more and more attention to data structure, and think that the essence of programming is to choose a good structure for a certain problem. In addition to designing a good algorithm, from the mid-1970s to the early 1980s, various versions of data structure works appeared one after another.
basic concept terms
It is difficult for a clever woman to cook without rice, no matter how complicated the data structure principle is, it must start from the data.
data
It is a symbol that describes objective 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.
In addition to integers such as 1, 2, and 3 or decimals such as 1.5, 3.333, and 7.89532, non-numeric types such as characters, sounds, images, and videos are also data.
We can search text and pictures on Baidu, and textbooks and books used in class can be used as data for sharing.
The data defined here are symbols that satisfy the following two conditions:
- can be entered into the computer
- can be processed by a computer program
Numerical data can be calculated, and non-numeric data such as pictures can also be converted into characters by means of encoding.
For computer recognition of pictures, please refer to the first third of my work:
data object
A collection of data elements of the same nature is a subset of data.
"Person" is made up of many individuals. Different names, genders, birthdays. . .
So! People with the same name, the same gender, and the same birthday can form a data object.
data element
It is a basic unit that makes up data and has a certain meaning, and is usually treated as a whole in a computer.
Data elements, also known as nodes or records, are usually considered and processed as a whole in computer programs. For example, bibliographic information for a book is a data element.
A data element is a unit of data that describes the definition, identity, presentation and allowed values with a set of attributes.
data item
A data element can be composed of several data items, and a data item is the smallest indivisible unit of data.
A data item is the smallest identification unit with independent meaning, a specific value of a data element, and the most basic and indivisible well-known data unit in a data record.
data structure
Different data elements are not independent, but have specific relationships, and these relationships are called structures.
Structure, a simple understanding is a relationship. Isn't molecular structure the arrangement of atoms that make up a molecule?
A collection of data elements that have one or more specific relationships with each other is a data structure.
Logical Structure & Physical Structure
According to different viewpoints, logic can be classified in two ways
logical structure
Describe the interrelationships between data elements in a data object
1. The collection structure has no other relationship except that it belongs to the same collection
2. One-to-one relationship between linear structure data elements
3. One-to-many relationship between tree structure data elements
4. Many-to-many relationship between graphic structure data elements
physical structure
The storage form of the logical structure of data in the computer
- The sequential storage structure is to store data elements in storage units with continuous addresses, and the logical relationship and physical relationship of the data are consistent.
- The chain storage structure is to store data elements in storage units with arbitrary addresses, as shown in the figure:
type of data
A general term for a set of values of the same nature and some operations defined on this set
data type definition
- Atomic types are basic types that cannot be decomposed, including integer, real, and character types.
- Structural types, composed of several types, can be decomposed. For example, a set of integers consisting of several integers.
abstract data type
A mathematical model and a set of operations defined on that model.
Abstract types can be obtained by abstracting existing data types. The characteristic of the abstract data type is to separate the use from the implementation, thereby encapsulating and hiding information. The abstract data type is implemented in a certain part of the program through a specific data structure, and only cares about the operation on this data type, not the specific implementation of the data structure.
For example, there are integer types in various high-level programming languages . Although they are implemented in different ways, they are "the same" to programmers, that is, they have the same mathematical properties. From the perspective of "mathematical abstraction", integers can be called an abstract data type .
Welcome to like, collect, and comment in the comment area, and reprint to indicate the source.
--------------------
Links below: