Chapter Introduction
In This Chapter
In the previous quick start section, we explained ten sorting algorithms and helped you implement common data structures in algorithm problems. However, we have not really started practicing problems.
From this chapter, we will focus on practicing problems. You will learn several key algorithm templates, then use lots of exercises to practice and understand these templates.
The content of this chapter is very important. All articles and exercises on this website are based on the algorithm templates summarized in this chapter.
Even I get new ideas from this chapter when practicing problems, which helps me update and improve the content.
So I suggest you come back and review this chapter during your learning. Each time you review, you will find something new.
For Beginners
The content in this chapter may seem abstract, but I still put it at the beginning of the practice section. I hope everyone reads it. If you remember some of it, you will benefit when practicing problems in the future. I am confident about that.
This chapter may mention algorithms from later chapters. This is to help connect all the concepts together.
It is normal for beginners to find this chapter difficult. If you don't understand something or haven't learned a certain algorithm, just skip it. Don't get stuck on it.
Don't worry. The articles and exercises in later chapters are all based on this chapter. These will help you use the abstract templates in this chapter over and over again. Many things will make sense after you practice more, and when you return to this chapter, everything will be much clearer.
For Readers with Some Experience
Templates are helpful, but you need to practice them to really understand and use algorithmic thinking well.
Many readers tell me: After learning the templates, they can come up with ideas for most problems, but it's still hard to write the correct code in an interview. Usually, this happens because they have read the articles but have not practiced writing problems themselves.
If you have this confusion too, you can try the "Strengthen Exercises" in this site's catalog. These problems can be solved using the code templates in this chapter. I recommend you practice them yourself.
Finally, I hope you can master algorithms soon!