[A83] Re: push - pop


[Prev][Next][Index][Thread]

[A83] Re: push - pop




It's really quite simple.  I haven't seen many things explain it in an easy
to understand manner.  I don't remember where I first learned about it.
Probably in one of Peter Norton's books.

Anyway, it is called a stack because, well, it's a stack.  Think of a stack
of plates in a cafeteria.  You know, those spring loaded kind, usually found
in those $2.99 buffets.  Now, if you are ever in Albuquerque and looking for
Chinese food, avoid the buffet on Menaul.  It's absolutely terrible.  Even
the soft serve ice cream.  That's the only place I've ever been at that got
the ice cream wrong.  I mean, I wouldn't think that getting the ice cream
right would be that difficult, but apparently it must be.  Now in the Kanas
City area, there is this great Chinese buffet called the Fire Wok, good
prices, excellent food, be sure to check it out.

Right, so it's like this stack of plates.  You "push" a plate onto the
stack, and you "pop" a plate off by taking it off.  If you push a red plate,
then push two blue plates, you have to pop off the two blue plates before
you can pop off the red plate.

There are a lot of other mails explaining the exact details, but those are
easy to understand if you comprehend how it works.  If you are familiar with
the C++ STL, then know that the stack works exactly like the stack
abstraction using the vector container.

> Can somebody explain in the highest detail what push
> and pop EXACTLY do? There are a couple of registers
> but there's only ONE stack pointer... I don't get it??






References: