栈和队列

来自姬鸿昌的知识库
跳到导航 跳到搜索

https://www.bilibili.com/video/BV1hg411V7Bm?p=58

栈和队列.png


队列(Queue)

队列.png

先进先出(FIFO——first in first out)

队尾(rear)进行插入操作

队头(front)进行删除操作


栈(Stack)

栈.png

先进先出(FILO——first in last out)

栈顶(top):进行插入和删除操作的一端称为栈顶

栈底(bottom):固定不变,不可进行插入和删除操作

进栈/压栈:Push the Stack

出栈/退栈/弹栈:Pop the Stack