相关内容:
队列的概念
队列(queue)是另一种限定存取位置的线性表.它只允许在表的一端插入,在另一端删除.允许插入的一端叫做队尾(rear),允许删除的一端叫做队头(front).队列存取数据的特点是”先进先出“.
链式队列:
链式队列是队列基于单链表的一种存储表示.在单链表的每一个结点中有两个域:data存放队列元素的值,link域存放单链表下一个结点的地址.队列的队头指针指向单链表的第一个结点,队尾指针指向单链表的最后一个结点
用单链表表示的链式队列特别适合于数据元素变动比较大的情形,而且不存在队列满而溢出的情况.
代码相关内容:
1 | #pragma once |
main.cpp
:
1 |
|