C++ notes: stack

1. What is a stack

Stack (stack), like queues, dynamic arrays, etc., is a linear data structure. Its rule is: first-in-last-out, last-in-first-out, which is the opposite of queue. The stack example is very common. Almost all cafeterias have a stack of trays or plates, you take one from the top, and there will be a new tray for the next guest. Imagine that there is a pile of books on the table. Only the cover of the top book is visible. To see the covers of other books, you have to remove the book on them first.

Two. Some concepts of the stack

  • Stack top and stack bottom: The end that allows element insertion and deletion is called the top of the stack, and the other end is called the bottom of the stack.
  • Push into the stack: Insert operation of the stack.
  • Pop: The delete operation of the stack.
  • Legend of the stack

Guess you like

Origin blog.csdn.net/Keven_11/article/details/107916177