Talk:LIFO

From Wikipedia, the free encyclopedia

[edit] Better analogy?

could a stack of plates be used as a better analogy to help explain LIFO rather than a crowded elevator?

eg: a dish is placed on top of the stack, and when one is needed, it's taken off the top of the stack.

You're onto something, but the problem with plates is that their order doesn't really make a difference as they're typically all the same. --TuukkaH 13:30, 1 May 2006 (UTC)

But it's still better than the rubbish elevator analogy. What about a queue for the checkout at the supermarket? The firstone there is the first one to leave.

Well, queue is not a stack and therefore not a LIFO but FIFO structure! Better analogy is a bookshelf where you place books on the top of one another. This way you can directly access only the last book you placed on the top. They are all books (the same class) but different ones (different objects - instances). --kostandin 22:55, 17 August 2006 (UTC)
Unfortunately books tend to get placed in a bookshelf next to one another ;-) Trying to come up with stacks, I remember in carpet shops and the likes, the salesperson would show the carpets in a huge stack by taking the topmost and moving it to the top of another stack. --TuukkaH 23:43, 17 August 2006 (UTC)

[edit] Another one?

What about Magic: The Gathering's stack? —The preceding unsigned comment was added by 71.127.122.7 (talk) 09:47, 11 March 2007 (UTC).