Re: Stacks

From: Jonathan Mcdougall (jonathanmcdougall_at_DELyahoo.ca)
Date: 10/08/03


Date: Wed, 8 Oct 2003 16:51:07 -0400


> > Hello All!
> >
> > Is there a place where I can learn stacks, (push and pop) etc.
> > Thanks,
>
> Yep. Your kitchen! Seriously!
>
> Take some plates. Stack them.
> If you put a new plate on top of that stack, you 'push' it onto the
> stack.
> If you take the topmost plate from the stack, you 'pop' it from
> the stack.
> Observation: In the pop operation you always get the plate which
> was pushed last. That's why such a structure is called LIFO (last in,
> first out).
>
> That's all. Simple, isn't it?

One more thing : if you try to put to much plates, the can fall off
the table (which is called a stack overflow). Not something you want.

Jonathan



Relevant Pages

  • Re: Why is recursion useful?
    ... Recurse when you need a LIFO stack, and borrowing the system stack makes ... A Last In First Out stack works like one of those springy plate dispensers ... You can't easily get to the plates at the bottom when the dispenser is full. ... You could do that without recursion, ...
    (comp.programming)
  • Re: Add/Subtract or Leave Weight the Same
    ... Standard pulley with a weight stack. ... concentric and compared that to distance of the point A and B ... Then a 25 kg plate. ...
    (misc.fitness.weights)
  • Re: pop/push, shift/unshift
    ... to remove a plate, you pop it out of the top of the stack. ... ;-) (Because Ruby uses push and pop on the end of the array ... of being built on the array structure (with various other paradigms, ...
    (comp.lang.ruby)
  • Re: Stacks
    ... If you put a new plate on top of that stack, you 'push' it onto the ... Karl Heinz Buchegger ...
    (comp.lang.cpp)
  • Re: Whats the record for stack size at 1/2 NL on PP?
    ... the max buy-in the stack size amount seen would be meaningless. ... Jonathan wrote: ...
    (rec.gambling.poker)