固定大小的 FIFO 队列的正确术语是什么?
以下数据结构的正确名称是什么? 它是:
- 固定大小的队列
- 新元素被添加到开头
- 每当队列超过一定大小时,就会从末尾删除一些元素
What is the correct name for the following data structure? It is:
- A queue of fixed size
- New elements are added to the start
- Whenever the queue gets above a certain size a number of elements are removed from the end
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
“固定大小的 FIFO 队列”
有时是缓冲区,有时是环形缓冲区(因为这就是通常实现的方式)。 我不知道任何表明您批量删除项目的策略,尽管这并不罕见。
"a fixed sized FIFO queue"
Sometimes buffer, sometimes ring buffer ( as that's how it's normally implemented ). I'm not aware of anything which denotes your strategy for removing items in batches, though it's not uncommon.
我认为这可能取决于实际执行情况。 您所描述的一个实际示例是 循环缓冲区 或环形缓冲区,其中最旧的数据被覆盖一旦缓冲区已满,就可以接收新数据。 这将是用 C 等语言实现此类数据结构的传统方法之一。
编辑: 好吧,所以循环缓冲区不太适合。 有限缓冲区队列或有限容量队列怎么样? 但这些并没有真正涵盖自限制方面......
自限制有限容量布拉特队列。
自动弹出...
我的观点是,我认为具有您提到的精确属性的数据结构没有一个正式名称,因此您不妨根据数据来编一个名称最接近它的结构,也许与您的结构的一些独特属性相结合。 不过,它可能会非常冗长...
编辑:或者可能是循环队列。 文章将其描述为:
...这听起来很像你的。 又好看又简洁。
I think it may depend on the actual implementation of this. A practical example of what you describe is the Circular Buffer or Ring Buffer where the oldest data is overwritten by new data once the buffer is full. This would be one of traditional ways of implementing such a data structure in something like C.
EDIT: Ok, so the Circular Buffer doesn't quite fit. How about Finite Buffer Queue, or Finite Capacity Queue? But those don't really cover the self-limiting aspect...
Self-limiting Finite Capacity Bratt Queue.
Auto-popping...
My point being that I don't think there's an official name for a data structure with the exact properties that you mention, so you might as well make one up based on the data structure that nearest resembles it, perhaps combined with some of your structure's unique properties. It's probably going to be pretty wordy though...
EDIT: Or perhaps it's a Cyclic Queue. The article describes it as:
...which sounds a lot like yours. Nice and concise too.
它是一个循环缓冲区
it is a circular buffer
在硬件中,类似的结构称为移位寄存器。
In hardware, a similar structure is called a shift register.
在嵌入式系统中,这几乎普遍称为循环缓冲区。
In embedded systems, this is almost universally referred to as circular buffers.