The introduction

Stack, which is a simple data structure, so simple that everyone ignores it. It wasn’t until recently, when I used it repeatedly to solve many algorithmic problems, that I realized that this data structure wasn’t as simple as I thought it would be.

Basic knowledge of

  1. A stack is a data structure, and it is our convention to only get “data” from one end that gives it the following properties: first in, last out (or last in, first out).

  2. The difficulty of learning it is not big, the difficulty is to encounter complex problems, can think of using it to solve. Of course, the only thing to keep in mind is: first in, last out, that’s all.

  3. Sometimes, one stack is not enough, you can use two stacks!

  4. The best way to understand abstract concepts is to find a corresponding “concrete thing”.

A picture is enough to