Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
将bag对象用于图中的邻接列表条目的目的是什么?为什么不使用像 astack或 a这样的数据结构queue?
bag
stack
queue
邻接表最重要的部分是它是可迭代的。虽然堆栈或队列肯定会起作用,但它们不是迭代的首选数据结构。
bag 的另一个重要属性是它按顺序保存元素。它在 C++ 中用作多重集。