Getting Started|How does the student learn the data structure by himself?

Getting Started|How does the student learn the data structure by himself?

Write in front


Today, I would like to briefly share the methods and techniques of self-study data structure and algorithm learning for half a year. The main purpose of writing this article is to allow readers who have just come into contact with data structures to learn in stages according to the summary method.

I am currently studying at a third-rate university. The reason I am a scumbag is that at the beginning of learning programming, I was really half a beat slower than others. I always encountered all kinds of confusion and confusion. When the console encounters various errors, I always hope someone can solve it. That's fine, but reality often slaps you in the mouth. After a nap, you still have to bite the bullet and solve it yourself. I believe most beginners have such doubts.

But later, I paid more attention to the pursuit of learning methods and learning efficiency, but now I am still a scumbag, because the real boss is fearless, all I can do is to help some people on the road of programming to solve the confusion and improve Look at learning efficiency. The Internet and programming technology are updated too quickly. If you do not have efficient learning methods and learning efficiency, you will be left behind by the times. So starting from today, you will pay more attention to learning methods and efficiency, and you will become more and more valuable in the future Internet. And presence.

During the three years of university, I basically taught myself programming. The attitude of the teacher is that I am too lazy to talk. I can talk nonsense in class and try to talk nonsense. It is good to give you the scope of the exam at the end of the term. The job interview will not be related to me at all. Whether you graduate or not has no effect on me. At that time, I decided to learn to program, most of the time by self-study, including class to do my own things.

For the same technology, have you ever wondered why someone learns it quickly and uses it quickly, but later discovered that it’s not caused by stupidity. Don’t always blame yourself for not being suitable for this or that. I also thought that at the beginning, but now it is completely It is suitable for high-intensity learning of programming.

Today I will mainly share the correct way to learn the data structure. I can’t guarantee that it’s suitable for everyone, but I can guarantee that it’s much more efficient than you blindly go to the book and read the book to see. Let's start with all aspects, that is, motivation, goals, practice, feedback, and raising standards.

My foundation


Speaking of the basics before learning the data structure, it’s a shame to say it, I only know arrays, and they are arrays in C language, array subscript values, traversal and other operations, don’t laugh at me, but I have been exploring step by step in the past six months , I finally know the importance of data structure in solving practical problems. The performance optimization of distributed and high-concurrency systems is inseparable from data structure. I hope this article can not only share with you the method of learning data structure, but also hope you Can fall in love with data structures.

My motivation


To learn a technique, you must first have motivation. So what is the motivation? We often see people who lose weight usually put a picture of a good figure in the room, just to generate motivation to keep losing weight every day. Learning is the same. Without motivation, there is no motivation to learn. So what was my original motivation for learning data structures? I'm going to practice internship soon. I want to find a good company for internship. It is impossible to enter an ideal company without the foundation of data structure and algorithm, so I will enter an ideal company as my motivation for learning.

My gain


After the self-study of data structure in the first half of the junior year, I have made a qualitative leap compared with my previous self. From the origin, what, characteristics, advantages and disadvantages of a certain basic data structure to how to use it in actual projects, How to cultivate your own subconscious data structure (when you encounter a problem, you can subconsciously think of which data structure to use according to the characteristics of the problem). Later, I gradually learned to link multiple data structures to solve problems. The purpose of this is to make the program performance more stable and more efficient.

These are the results of constant training in dealing with data structures every day for the past six months. In the past six months, I have basically not relaxed one day. Even on New Year's Eve, I have been working on algorithms and researching data structures. The hard work pays off, no matter how bad the foundation is, no matter how stupid the mind is, you can learn the data structure through the learning methods I summarized.

My practice


Because I went to a third-rate university, most of the time I depended on self-study and summarized a lot of ways to improve learning efficiency. So how did I learn about data structure? I divided the study of data structure into three stages.

The first stage: understanding the data structure

The first step: To learn it, you should know what the 10 data structures of arrays, linked lists, stacks, queues, hash tables, jump tables, graphs, trees, heaps and dictionary trees are used for, why and how to do it, Xiaolu recommends to see some basic You can use Baidu and Google to briefly understand what each data structure is used for, why, and how to do it. Then you can simply take notes and blogs.

Step 2: Each data structure has its advantages and disadvantages and its performance. What criteria should we use to measure the performance of data structures and algorithms? Then the second step is to learn the content of complexity analysis related to time complexity and space complexity. This part of the content is very important, because the data structure and algorithm to be learned later must have a performance measurement standard, in order to be different To solve the problem, select the data structure and algorithm with the best performance.

The second stage: in-depth data structure

The first step: write code. The ten most basic data structure-related characteristics and usage conditions above have been taken notes, and then we have entered into an in-depth study of each data structure from the beginning. First, the operations involved in the data structure, such as adding, deleting, modifying, and checking, etc. Implement it by yourself, run it on the machine, and pay attention to the following points when writing code: boundary conditions, pointers, and code specifications.

This will make you more in awe of the code. Every time you write the code, you must take it seriously. If the code on the machine is okay, you can do it yourself by handwriting with a pen in your notebook, which will help you deepen you. Understanding of the code logic.

Step 2: In the first stage, we learned about the performance measurement standards, then the next step is to go back and analyze the performance of the operations involved in the 10 most commonly used data structures. You may ask, why not perform performance analysis while writing code?

I think the advantage of phases is that they can focus on solving problems. Writing code is to exercise the thinking and logical ability of writing code. Performance analysis is to improve your analytical ability. After performance analysis is completed, look at the code you wrote before that can be optimized. improved. During this period, you will encounter various problems. What to do if you encounter problems, I usually go to Baidu or Google to summarize and record in the notebook with the help of articles written by others.

The third step: After the performance analysis of each data structure is completed, proceed to in-depth analysis of each data. The first stage I recommend is to read some basic books, the knowledge level involved is not deep. But we still need to have at least an authoritative and in-depth analysis of data structure books in order to have a deep understanding of some concepts. After all, basic books are for you to get started. We can use these highly authoritative and comprehensive content to check the deficiencies in the data structure knowledge points we have learned.

Step 4: In-depth study alone is really boring and complicated, so let's analyze real life examples, such as the number guessing game, the 0/1 backpack problem, the maze, the eight queen problem, and the full reduction problem Wait. Like the number guessing game, we can think about how we can guess the correct number in the shortest time. Maybe you will think of using binary search. Well, let's ask ourselves the problems of binary search. In this process, we must ask ourselves why. Only in this way will your knowledge level be expanded. For example, how to solve binary search if there are duplicate data in the data?

I still want to emphasize that you must ask yourself why, because from the psychological point of view, the human brain conforms to the principle of least resistance, that is, thinking things least like to do, so here we have to go the other way to make further breakthroughs. If you think there is no problem in the above two stages, we will proceed to the third stage below to retrieve the data structure.

The third stage: retrieve data structure

The first step: At this time, you may learn a lot about data structure, but it is difficult to apply it. How can you apply it to practical problems? Have we sorted out the fragmentary knowledge points in the notebook? What should I do next? We can use the mind map to organize the knowledge system, whether it is review and consolidation, it will help us to further strengthen.

Step 2: After finishing the above system, go to Google or Baidu to search for actual problems with clear solutions for analysis and learning. You will find in these actual projects that many problems involve multiple data structure problems. , What we are solving in front is only for a single data structure, then try to establish a connection between the data structures.

For example, arrays and linked lists, each data structure has advantages and disadvantages. In the process of learning, you will find that the advantages of one data structure are the disadvantages of another data structure. The array is continuous in the memory space and is friendly to the CPU cache. The linked list is a fragmented memory space in the memory, which is not friendly to the CPU cache, but the linked list can be dynamically expanded but the array cannot.

For another example, in order to improve the efficiency of the program, we have to replace another data structure with a data structure that consumes more memory space. If the memory is tight and the execution efficiency is not high, we will use memory-saving data that is slightly less efficient. Structures replace data structures that take up a lot of memory and execute fast.

The third step: learn to convert actual problems into the data structure learned. How to transform? For example: If you are an engineer, how would you solve the problem of optimizing the algorithm for implementing caching of linked lists? Let's first convert the problem into the data structure we have learned. The linked list is mentioned in it. So we know that there is a linked list. What operations have been implemented using the linked list in the analysis? Eliminating data, finding data, and caching data, these three operations all involve lookups, we have to traverse the entire linked list, and the time complexity is O(n).

Then we wonder if we can optimize the search? Find the applicable data structure according to the problem or the characteristics of the data. The three operations of the cache involve fast insertion, deletion, and query of data. What are the data structures that we can quickly achieve insertion, deletion, and query by fast retrieval in the brain? Balance binary trees, hash tables, jump tables, etc. For example, we choose hash tables, and finally analyze whether the time complexity is optimized a lot, otherwise we will change to another data structure for performance analysis.

It is not difficult to find that the actual problem will be decomposed step by step into the basic operation analysis of the data structure we have learned, and then use the advantages and disadvantages of the data structure we have learned and performance analysis to get the best solution, but in The actual problems encountered in the enterprise are often more complicated than the actual problems we take as exercises.

postscript


The above are the three stages of my study of data structure. If you have completed the above three stages, I still suggest to reconsolidate and review the most basic 10 data structures. Continuous feedback is required in the three stages of consolidation and review. And raise the standard, I believe you will find that every knowledge point will have new gains.

The above is the method of learning data structure that I have summarized for half a year. There is also an article on "Improvement|How to learn data structure", which I shared this weekend, but I feel that there are many deficiencies in many places, or many beginners do not understand Steps, repeated revisions over the weekend, with a little hesitation, but being able to write an article well, the reader’s greatest gain is the greatest motivation for me to write it down and revise it forever. If it feels good, you can secretly send it to your good friends Oh!

Getting Started|How does the student learn the data structure by himself?

Guess you like

Origin blog.51cto.com/15064450/2602323