2020 data structure notes start: Chapter 1 (Introduction to data structure)

This semester is finally about to start the data structure, because the school arranges this course relatively late, it should be arranged for the previous semester, but it was arranged by the school after all. So I learned a little while I was fine, hahaha.

The school exam is also coming to an end. It’s not difficult to stick to the output of an article every day. What I think of is how to make everyone understand, and even make it easy for everyone to read and read. Interesting, this is obviously not that easy for me personally, but I still want to try it, haha, if there is a bad writing, please actively point it out.

Origin of data structure

Maybe when you first started programming, you were at a loss when faced with the black output window. There was neither the visual sense on mobile phones nor the operating sense of software on computers. That feeling seemed to have entered a fake profession. I was learning. Computer? Just a bunch of dark windows? ? ?

It's a bit farther. Going back to programming, it was actually quite simple for us to write the program at the very beginning. It only needs to run successfully. If there is a red error, it is really exciting. Maybe this is the reason to keep us, hahaha, this reason is a bit far-fetched.

So we return to the essence of programming , why do we write programs? Simply put, it is to solve a problem, so what should we do before we start to solve a problem? Should we abstract a solution model from a specific problem, such as what should be done first, and then what should be done, and then we will also consider that this model is for others to use, then this will generate some user data, Combine this model with user data and we will get an appropriate data model.

Then we combine this data model and the designed algorithm (to be discussed later) and write it into a program, and then we will get an actual software.

Obviously, the data structure does not exist independently, so I don't really like its definition. It is not meaningful to define a non-independent term. But the editor will still release it for everyone!

Data structure: a way to store and organize data in a computer. (From Wikipedia)

Basic concepts and terminology

**Data: ** 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.

To: So what are the data? In fact, data are symbols, and these symbols have two prerequisites: they can be input into a computer; they can be processed by computer programs. Here are a few examples: For example, the mp3 we listen to music is sound data, and the picture is picture data, or directly, everything can be digitized.

Insert picture description here

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 and is also called a record. For example, an animal in a certain type of animal is a single data element.

Data item : A data element can consist of several data items. A data item is the smallest unit of indivisible data. Data items are also the smallest unit of data, but when discussing problems, we are accustomed to using data elements as the focus of establishing a data model in the data structure.

Data object : It is a collection of data elements of the same nature, which is a subset of data. If there is no confusion, data objects can also be referred to as data for short.

Data structure : Structure refers to the way in which various components are matched and arranged. Then there is a collection of one or more specific data elements between the data structures.

Two major structures: logical structure and physical structure

Logical structure (to solve a problem, problem-oriented) and physical structure (computer-oriented)

Logical structure : Refers to the interrelationship between data elements in the data object in the object, which is mainly divided into the following four types.

Collection structure : The data elements in the collection structure have no other relationship except that they belong to the same collection.
Linear structure : There is a one-to-one relationship between data elements in a linear structure.
Tree structure : The elements in the tree structure have a one-to-many hierarchical relationship.
Graphic structure : The data elements in the graphic structure have a many-to-many relationship.
Insert picture description here

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

When it comes to storage structure, we have to talk about storage again: mainly for memory, the data organization of external storage such as DVD discs, hard disks, and floppy disks is usually described by file structure.

The storage structure of data elements (the storage structure of data should correctly reflect the logical relationship between data elements) has two types: sequential storage and chain storage.

1. 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. It can be simply understood that everyone is lining up for a meal, and they are arranged in order.

2. Chain storage structure : It stores data elements in any storage unit. This group of storage units can be continuous or discontinuous. In chain storage, pointers are mostly needed to store the address of a data, and then the address of the relevant data element can be found through the address. After the pointer is added, the chain storage is much more flexible. No matter where we store the data, we only need a pointer to store the address of the data and we can find it.

**

Abstract 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.

Abstraction refers to extracting the universal essence of things. It should be noted that it extracts the characteristics of the problem and ignores non-essential details. In fact, abstraction can also be regarded as a way for the human brain to think about something, and then find its essential characteristics.

Abstract data type : refers to a mathematical model and a set of operations defined on the model. Its definition depends only on its set of logical characteristics, and has nothing to do with how to implement it inside the computer. Abstract data types reflect the characteristics of problem decomposition, abstraction and information hiding in program design, which means that it takes real life The problem is broken down into multiple small and easy-to-solve problems, and then a data model that can be processed by the computer is established, and the implementation details of each functional module are regarded as an independent unit, so that the specific implementation process is hidden.

The above content is partially defined from the book "Dahua Data Structure" if there is infringement, infringement and deletion

Guess you like

Origin blog.csdn.net/m0_46259251/article/details/108923649