C. Data Structure-Overview (1)

Source: Internet
Author: User

Introduction: before getting into the workplace and getting into touch with product development, the foundation is still the most important. The advantage of a university is to learn as you like. If you understand it, do not violate the rules or break the law. Well, for a period of time since today, I began to write and understand the C language and data structure, and finally cherish the university. There are one thousand million readers, and one thousand of them are Hamlet. The error is irrelevant to the right. Maybe today is superficial. I have a new idea that I will come back to improve it.

 

The programming language is actually something that I like to think of as a data zone or block and perform related operations.

Get up in the morning and everyone goes to class. I took the bed and picked up the data structure and algorithm analysis of the bed. I didn't like the previous teachers at all. I learned from the class and didn't give us a model. I also offered bilingual teaching. That is, the textbook is in English, and the teacher does not speak any English. At that time, I learned MCU, but I didn't learn it hard. I scored 60 points in the examination. I did not look at the big question in the circular linked list. It was a mistake. I haven't touched this book for a long time. I just got up after reading the list in bed.
Marxism tells us that things are interrelated. Well, I use the memory space structure and C language to understand these things, as well as the compiler.
Understanding the language requires at least understanding the memory space structure and how the compiler works. I dare not say that my c is good. I can only say that the basics are okay. Now I am too proficient in my resume. Now, let's take a look at the data structure and understand the C language code. There are a lot of concepts of others, and sometimes they are just like a duck, so it is king to understand them with your own ideas.

Value, Location Value, data zone, base address + offset address, data type and structure, data definition, initialization, and reference.
1. Values and values -- these two are just my concepts. Generally, Data, addresses, pointers, and array names are written in C's books. This is what people like, and I think the CPU processes commands and data, everything in a computer is binary. 0 and 1 are all data. Once the code is compiled, it is all the target code. Isn't all data stored in the physical memory? However, we need to differentiate these things, some of which are real data (numerical values) to be processed ), some are the data's home card (Location Value), such as the variable name just mentioned.
2. Data zone-the storage is based on the data type, which is continuous storage. It can be a large unit or a small unit. However, both command storage and data rewriting must locate the location by block (the base address of the data block), either to process the entire large unit, a small unit, or a single data type, for example, if a table is a large unit, a node is a small unit in a large unit, and each field is the corresponding data type, value, and Location Value.
3. base address + offset value-this is the method for finding data blocks. The storage space is the physical memory size, which is generally measured in KB, MB, GB, etc. These spaces are mapped to the corresponding address space, that is, the number is coded to let the CPU know, for example, from 0 to 10, the size is 11, and the editing address is from 0 ~ 10, (basically from 0 in the computer ). The physical connection of the memory is mounted to the system bus, and the decoder translates commands so that the CPU can find data for data processing. The base address + offset address is a data block that is continuously stored in a space. The base address is a large unit address, and the small unit is a small unit that can be re-numbered. For example, in x8086, the data block segment address is 0x2000 and the offset address is 0x03. Then, the base address + offset address can be used to find the unit value of 0x20003. Note that the x8086 segment address memory is 16-bit, and the address line is 20, so there will be address value processing. In the struct, p-> next can be interpreted as this. For example, in the data structure table, if the P Pointer Points to the node, the location value of P is the continuous storage structure of node, p-> next is the P base address + next offset address, and the next field is found. The data is the location value, which is placed in the address register for processing.
4. Data Type-there is nothing to say, that is, the basic data unit form, the amount of memory occupied. There are not many others.
5. Data Structure: A Basic data unit or above. Memory space distribution.
6. Data Definition, initialization, and reference-as I said earlier, computers process data. The definition in the code is to give the Location value, and the initialization is to fill in the data area, it can be a value or a local value. The reference is to use the data and get the register for processing. For example, Tan Lao's book: the definition of a one-dimensional array is a type specifier array name [constant expression]. Then the following is the form. Actually, this is not the case. It seems that we didn't talk about the essence. In the past, I thought that the compiler was responsible for all the tasks.
For example, variable definition, array definition, pointer definition, struct definition, shared body definition, function definition, and so on, in my opinion, all are given to the ground value, if it is not a large unit, or a small unit. Initialization: Fill in the content in the data area corresponding to the local value. The variable is a value and a pointer. Struct data block. Reference-the two elements of the Data Location value and value can be used to process the data. This is obtained from the algorithm and operated in the register. Save the changes or release them.
This is the core of the Code construction model. Maybe I am not good at Chinese. For things in general tutorials, I always feel that there are too many terms and concepts, which are too complicated. I still need to understand and simplify myself. After all, knowledge is something in your mind.
I will write this today. I will analyze some code next time, such as tables, stacks, queues, trees, and some sorting algorithms. Are very basic.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.