Re: Stacks

From: rossum (rossum48_at_coldmail.com)
Date: 10/09/03


Date: Wed, 08 Oct 2003 23:28:20 +0100

On Wed, 8 Oct 2003 16:51:07 -0400, "Jonathan Mcdougall"
<jonathanmcdougall@DELyahoo.ca> wrote:

>> > 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
>
And trying to take more plates off the stack than you put on (which is
called stack underflow) is also something you want to avoid.

rossum

--
The Ultimate Truth is that there is no Ultimate Truth


Relevant Pages

  • Re: When is a stack used in real life?
    ... What you really want for plates is ... > My socks form a mathematical set in that no two are alike. ... > stack, the plate is still warm and wet from its washing. ... > dishwashers are out back for a smoke, ...
    (comp.programming)
  • Re: pop/push, shift/unshift
    ... and it's taking a surprising amount of time to "grok" them. ... The way I think of a stack is as, literally, a stack of plates. ...
    (comp.lang.ruby)
  • Re: Stack of 7-10 plates
    ... I need to make a "large run" of mounting plates - for me that means more ... sets of related holes. ... Would you stack, clean up the edges, drill the holes (they need to be ... then separately do the counter sinking on a drill press? ...
    (rec.crafts.metalworking)
  • Re: When is a stack used in real life?
    ... What you really want for plates is ... My socks form a mathematical set in that no two are alike. ... stack, the plate is still warm and wet from its washing. ... dishwashers are out back for a smoke, ...
    (comp.programming)
  • Re: What does an "export" do?
    ... :>: Dan Mercer wrote: ... You seem to be using "stack" in a way different from most programmers. ... staff adds new plates to the top and then customers take them off. ... terminology, and, living fossil that I am, I never changed. ...
    (comp.unix.shell)