Well, I guess if you are always taking the bottom pancake out, then you will make the whole stack cooler
posted 3 years ago
First, a non-technical example
What I thought about is
suppose you have a big garbage-bin, and, you put the big garbage-(eco-friendly)polythene bags in it, one over the other (PUSHING in stack). Then, when those people come for garbage-collection, they take out the latest bags first (POPPING)...
A similar technical example...
Suppose, in some object-oriented programming language X, there is a 'Garbage-collection' mechanism like we have in Java. But, that programming language X, has a feature to Stack (PUSH) each object one over the other as it is created into a Stack, and, just before the program ends, the language has a feature to automatically destroy the objects that were created. For, destroying the objects, it starts from the object which is right at the top of the stack, the newest object created, and first removes it from the Stack (POPs it), and then destroyes it. Similarly, it Pops each object which is at the top.. until the stack of objects' list is empty.