A lot of people are preparing for promotions or job changes these days, and most of them don’t take algorithms and data structures into account. The reason is that the algorithm, a lot of people think that there is no need for the front-end algorithm, the algorithm is at the back end, big factory just to screen the algorithm, the actual work is not necessary. I’ve heard this answer a lot, and I don’t usually refute it. Just ask a few questions. Such as:

Have you used a Map before? When will you use a Map? What is the difference between a Map and an object? Why is that? Hash table? Why is the performance better when you use hash tables? How to choose Map and object?

How to sort an array of numbers. Use array sort? Why? What if I have a lot of data? What if instead of numbers in this array, it’s objects, and I want stable sort, do you still use sort? How to implement sort?

Proficient in Vue? All Vue array nodes have keys. What are the precautions for this key? Read Vue source code? How is VDOM DIFF implemented in Vue? Longest increasing subsequence? How do I use the longest increasing subsequence? Why can’t I copy the algorithm for the longest increasing subsequence in Vue to LeetCode300? Did you write Rain Creek wrong? Why not use the longest common subsequence?

Good at the React? What data structure is Fiber in React? The list? Why use a linked list? Why not an array, which is what Vue uses? React executes high priority tasks first. There are a lot of tasks. The sorting? How do I sort it? React and Vue, right? How do they choose the technology? What’s the difference between their VDOM DIFF and VDOM DIFF?

Good at the back end? I have used Redis before. When should I choose Redis? Can I use Redis for payment? Redis quick, are you sure? Redis can be wrong? Why is that? How to avoid mistakes?

Did you encrypt it? Can the front end be encrypted? How? Safe? Do you need backend coordination?

Ask here first, these questions, some people say that they have never encountered, usually do is to add, delete, change and check CMS, then if you always do such simple work, how can you get promoted and pay? Do you want to try to do some complex projects, and for complex projects, the amount of data may be very large, so do you need to consider the Map and object selection for performance, will you choose? For some complex projects, if you put all the logic in the back end, if you interact with the server side too much and slow, then the user experience will be affected. Can you consider putting part of the logic in the front end, such as finding the restaurant with the highest score in the existing data?

I believe that at this point, you have realized the importance of algorithms. To put it bluntly, data structures and algorithms teach us to write code that runs efficiently. If you want to be promoted and paid more at the front end, take the first step and learn about algorithms and data structures.

Of course, many people ask how to learn algorithms and data structures, after all, learning algorithms is not easy, the question is actually very simple: 1. Watch video tutorials; 2. Read a book; 3. The brush. Of course, the first method is very simple and efficient. For the second and third ones, I will talk about them in detail. First of all, I suggest buying classic books, and at this time, I recommend Introduction to Algorithms and Algorithms:

“Introduction to Algorithms” is a very detailed book, talking about all the ideas in the field of algorithms, which is also the textbook my teacher asked me to buy when I was in college. However, this book is full of pseudo-codes, which can lead you to know the algorithm and understand the actual scenarios. Of course, the difficulty of the book is not low, so do not force yourself to master all of the beginning, can be used as a reference book, when reading. Red “algorithm” book has a lot of JAVA version of the algorithm code implementation, of course, the algorithm does not distinguish language, front-end partners to learn when it can be opened to JS. In addition to these two books, I also have a book called Data Structure and Algorithm Analysis, which covers a little more math:

I usually put the red “Algorithm” in the company, “Algorithm introduction” and “Data Structure and Algorithm analysis” at home, often turn over, especially when insomnia, of course, the effect of insomnia and your algorithm strength is inversely proportional to ~

Of course, you can only choose the red book “Algorithm”, but I think “Introduction to Algorithms” ideas about more detailed, and “Algorithm” and “Data Structure and Algorithm analysis” code implementation more, the theory is relatively less than “Introduction to Algorithms” more.

Last but not least, LeetCode is a great platform for editing questions, but there are so many types of questions that it’s not only difficult but unnecessary to do it all. At this time you should classify to brush, such as algorithm small white from the linked list to brush, slowly and then transition to stack, sorting, binary, hash, dynamic planning, etc., the choice of classic questions or interview questions on the line:

Finally, I wish you all success in your promotion and salary increase. Next time, we’ll look at step 2 of the promotion and salary increase routine. If you have any questions, you can leave a message and tell me. Recently opened a public account (Bubucuo), share more front-end dry goods content, pay attention to oh ~