In the first chapter, we explained why we learn algorithms and data structures and what they include.
In general, knowing algorithms and data structures makes it easier to keep up with computer trends, faster to understand the underlying principles of other frameworks, and more likely to land a job in the company of your choice.
It includes:
- Time complexity analysis;
- Spatial complexity analysis;
- Ten core algorithms: recursion, sorting, binary search, search, hash algorithm, greedy algorithm, branch algorithm, backtracking algorithm, dynamic programming, string matching algorithm;
- Ten core data structures: array, linked list, stack, queue, hash table, binary tree, heap, hop table, graph, Trie number.
An algorithm is simply a method to process data, and the data structure is a structure to represent and store data. Algorithms and data structures complement each other.
Among them, complexity analysis is the most important one, which is indispensable for any code to analyze its performance in theory. The main goal of the algorithm is how to better save CPU, memory resources, processing data to solve the problem. And we can’t measure an algorithm every time we run it on a machine. That’s where complexity analysis comes in. In addition, complexity analysis is often used when learning sorting and searching algorithms.
For a data structure or algorithm, we also need to know its development history, what characteristics it has, what similarities and differences it has compared with another one, suitable problem scenarios, what practical applications it has, and so on. In this way, we can understand a knowledge point from multiple dimensions and better grasp memory.
High school math and basic programming knowledge are all you need to learn about data structures and algorithms.
Practice: Be sure to write
When encountering a sorting or lookup algorithm, try to write it yourself without looking at the sample code. Then compare it to the sample code and think about the details you didn’t take into account and the areas of your code that could be optimized. Then write several more times on your own, and do two or three related questions in combination with the questions in LeetCode.
In recent years, whether the 10,000-hour rule, or deliberate practice. Are emphasizing the importance of practice. Through practice, on the one hand, muscle memory is enhanced; On the other hand, only in practice can you touch the details of the knowledge, which will make you think about it and strengthen the relevant nerve cells.
2. Summarize and share
After learning knowledge, also want to spend time to summarize and share. In the process, you will discover your weaknesses. When sharing, you need to consider whether the other party can understand what you say. After exposing your knowledge that you don’t know, you will make up for the lack of knowledge and gradually improve your knowledge system.
After sharing out, can also collision with readers out of some thinking sparks. It’s exciting to see existing ideas collide into new ones.
Feynman’s learning method emphasizes that after learning, we must teach others. Through the process of being a teacher, we should constantly have a deeper understanding and a more comprehensive understanding of this knowledge point, and finally achieve the purpose of in-depth mastery of knowledge.
3. Take your time
Learning is not like playing a video game, where you get constant feedback, and this is probably a big factor in the persistence of video games. Any knowledge learning needs a process of precipitation, you can not eat into a fat.
Don’t get discouraged and doubt yourself when you encounter problems. Because problems happen to everyone, and you’re not alone. There are a lot of things we can’t understand at that time, we can put it down first, wait for a period of digestion after a look may be suddenly enlightened. At this point, you need to look at the problem from a different Angle. We will encounter many problems in our life, and many problems need to be solved by dead knocks. At this point, we need to get over this hurdle and master the knowledge and tools so that we can use it in the rest of our lives. In this way, the investment of energy is not worth it.
4. Use tools
Finally, in order to help you better study data results and algorithms, I developed a visual small program. In this small program you can see the implementation of such as quicksort algorithm visualization, the boring code may be better to help you learn.
Wechat search VisualLearning can experience.