【 原 文 】Juejin. Cn/post / 684490…
Writing in the front
Hello, everyone. My name is Xiao Lu and I am a junior in college. Today, I’d like to briefly share some of the techniques and techniques I learned from studying data structures and algorithms in the second half of the year. The main purpose of writing this article is to let the readers who are new to data structure learn by stages according to the summary steps.
Fawn on an ordinary university, the three basic programming in the self-study university three years time, the teacher taught in class, after all, the course is very shallow, the teacher tells a knowledge point is to allow for most of the students’ different understanding ability, so for me this kind of like asking why students from freshmen have to spend a lot of time to start from learning programming. Self-study? I pay more attention to efficiency. Where does efficiency come from? I believe that many people who learn programming by themselves are most particular about methods and skills, while Little Deer’s learning method is constantly summarized in several stages, that is, motivation, goal, practice, feedback and raising standards.
The basis of I
First, let me tell you what I was prepared for before I learned data structure. When I was a sophomore, the school opened the course of data structure, but I was not interested in data structure at that time. After a semester, if someone asked me whether I knew arrays and linked lists, I would not be interested in data structure. I may have some structure in mind, other data structures such as: hash tables, jump tables, trees, etc., do not have any memory, or even know what they are.
My motivation for learning
Learning a skill requires motivation in the first place. So what is motivation? We often see people who lose weight keep a picture of their body in their room just to get motivated to keep losing weight every day. Learning is the same, there is no motivation, there is no motivation to study. What motivated me to learn data structures in the first place? The internship is coming soon. If 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 the motivation of learning.
My goal
After three in the first half of the data structure of self-study, compared with that before his have a qualitative leap, from the most basic one, what is the origin of data structure, characteristics, and advantages and disadvantages to the actual project should be how to apply, how to cultivate their subconscious data structure (encounter problems, according to the characteristics of problem can subconsciously thought in which data structure to solve). Later, I gradually learned to connect a variety of data structures to solve problems. The purpose of doing so is to make the program performance more stable and efficiency more efficient.
These are all from the training of dealing with data structure every day in the past six months, and I have never relaxed a day in the past six months. I believe that hard work pays off. No matter how bad the foundation is and how stupid the brain is, I can learn data structure well through the operation steps I summarized.
I practice
Because I went to a third-rate university and studied by myself most of the time, I summarized many methods to improve my learning efficiency. Then what did I do in learning data structure? I divided the study of data structures into three stages.
Stage 1: Understand data structures
Step one: Learn what it is used for, why and how to do it. Lu suggests reading basic data structure books or turning to Baidu and Google.
Step 2: Each data structure has its advantages and disadvantages as well as the performance of the good or bad, then we use what standards to measure the performance of data structure and algorithm is good and fast? The second step is to learn the content of complexity analysis related to time complexity and space complexity. This part is very important, because the data structure and algorithm to be learned later must have a performance measurement standard. In order to solve different problems, choose the data structure and algorithm with the best performance.
Step 3: We have seen the performance measurement criteria, so the next step is to start to learn the most commonly used data structures: array, linked list, stack, queue, hash table, skip table, graph, tree, heap, dictionary tree 10 data structures. The first stage does not require us to understand these data structures, but to learn from the following aspects. The origin, features, applicable conditions, operations, time complexity analysis of each operation and whether optimization can be carried out. During this period, you will encounter various problems, and how to solve the problems, I usually go to Baidu or Google to summarize and record in the notebook with the help of other people’s articles.
Stage 2: Drill down into data structures
Step 1: top ten kind of the most basic data structures related features and conditions of use are recorded on the notebook, then we can start from scratch for each data structure into the deep research, involves the operation of the first data structure, such as add, delete, change, check operation to realize again, on the machine running again, writing the code is important to note the following: Boundary conditions, Pointers, code specifications.
This will make you more respectful of the code, every time you write code should be taken seriously, if the machine is no problem to write code, you can write in a notebook pen to personally implement it, which will help you deepen your understanding of the code logic.
Step 2: You may ask, the first stage of each data structure characteristics basic understanding, what books or videos to in-depth understanding, about the video materials I will not recommend here, recommend books, this is not advertising. If we want to go deeper, we need an authoritative data, and there will be an authoritative explanation for what we want to look up. Although the book introduction to Algorithms is very thick, I can find what I want every time I look up it, so I can look it up as a dictionary to expand my knowledge system.
Step 3: In-depth study alone is really boring, so we will analyze practical examples, such as guessing number games, we can think about how to guess the correct number in the shortest time, you may think of using binary search. Ok, so let’s ask ourselves some questions about binary search, and make sure you ask yourself a lot of questions about why, so that you can expand your level of knowledge, like binary search, what if there’s duplicate data in the data?
Again, I want to emphasize that it’s important to ask yourself why, because psychologically speaking, your brain conforms to the principle of least resistance, which means you don’t like to do the things you think about, so here we have to work backwards to make further breakthroughs. If you feel comfortable with the above two stages, let’s proceed to the third stage below, retrieving the data structure.
Stage 3: Retrieve the data structure
Step 1: At this point you may learn a lot about data structures, but it is difficult to use, so how can you use them in practical problems? The first step is to do sorting, sorting out the fragmentary knowledge points to the notebook, how to sort it out? We can use the mind map to systematize the knowledge, which will help us to further strengthen both review and consolidation.
The second step: After sorting out the above, you will find that many problems involve multiple data structures in the actual project. We have only solved a single data structure, so try to make connections between data structures, such as 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, or that the problems solved by this data structure can make up for the problems that another data structure cannot solve. After repeated thinking, you will sort them out for future expansion on this basis.
Learned the third step: will the actual problem is converted into data structures, encounter problems, according to the features of problems or data to find the suitable data structures, such as we need to insert, delete, query the data quickly, we in the brain, a quick search can quickly realize the insert, delete, and query data structures have? Balance binary trees, hash tables, hop tables, etc. Then filter these data structures according to another condition or feature of the problem.
Step 4: How do you screen? Using the performance analysis that we talked about earlier, time complexity, space complexity, we know how to choose a reasonable solution.
These are my three stages of learning data structures. If you complete the three stages, do you think there are no problems? No, because we’re going to solve problems and we’re going to have a lot of situations, so what are we going to do, Jay?
My feedback
We should gain something every time we solve problems or review data structures. How can we increase our harvest with the same knowledge? That is to constantly feed back information to myself, for example, hashing conflicts the current solution is not applicable to the actual project, so I feed this information back to myself and ask myself if there is a better solution? After feedback, the next step is to raise the standard of learning.
An increase in the standard
There is always a bottleneck in learning data structures, and when we get out of the bottleneck, it will be much smoother, so you ask is there any possibility of further improvement? There will be, and then you will talk about improving your own standards, such as your ability to solve practical problems in your life subconsciously, without any reference data, which is very demanding for yourself, and improving your work efficiency, which seems to be very high standard, I believe that everyone only through continuous efforts to practice, feedback will one day exercise this ability, believe you.