0

I have been documenting myself about stacks, queues and deques for a small project. I will be requiring use of both stacks and queues for the project, and another type of structure, something similar to a stack, but that removes the final elements, such as this:

Stack from top to bottom (max 5 elem): [B][C][D][E][F]

Push A, becomes [A]=>[B][C][D][E]=>[F], result: [A][B][C][D][E]

I have been searching around wikipedia and such, but I don't know how to call this other than "some kind of stack". Results are LIFO, so popping would return A in the example, not F. The code is done as well, so I don't ask for help on that aspect.

My question is simpler: what would be the proper name for this structure?

EDIT: After examining the G5 library as suggested below. I decided to call them "Limited Stacks" or "Lstacks" since it's a name already used in a library. That would make the code more readable. Thanks to everyone!

roger_rales
  • 181
  • 1
  • 2
  • 7
  • You will most likely need to code one yourself. – diolemo Aug 23 '11 at 15:42
  • you may be interested in the following question - http://stackoverflow.com/questions/1292/limit-size-of-queuet-in-net – Russ Cam Aug 23 '11 at 15:43
  • Freshwire and Russ Cam: It's already coded! I just want to know if it's still named stack or has a different name! – roger_rales Aug 23 '11 at 15:52
  • @roger - I saw that you said that it's already coded, I just thought that the The C5 Generic Collection Library may be useful to take a look at. It's still a stack as far as I know. – Russ Cam Aug 23 '11 at 16:06
  • @Russ Cam : Oh! My bad. So they call those "limited stacks" in there? Sounds good enough. – roger_rales Aug 23 '11 at 16:11

1 Answers1

0

That looks like a FIFO stack to me. Item A is your last in, Item F is your first out.

Chains
  • 11,681
  • 8
  • 40
  • 61
B-Rad
  • 375
  • 1
  • 13
  • So there's no difference if I just destroy the last elements to keep it in a fixed size. It is still a "stack"? EDIT: Wait a minute, shouldn't LIFO be A last in, and A last out? – roger_rales Aug 23 '11 at 15:51
  • I believe so, you're just popping off the last element right before your push a new one. EDIT: sorry you're correct i screwed up the LIFO, this is more of a FIFO situation, first in first out. – B-Rad Aug 23 '11 at 16:00
  • Alright, then just for the sake of differencing I will name the struct "Fstacks" (fix sized stacks)! Thanks! I will keep the question open for a little while just in case, I hope you don't mind! – roger_rales Aug 23 '11 at 16:05