Make your own free website on Tripod.com
7.2.2 LIFO and FIFO stack operations
As already mentioned, the stack is a linear list of strings.
Obviously, this list has two ends. Strings can only be extracted
from one end, while strings can be added to both ends.

If a set of new strings are added to the same end as they are
later extracted from, the strings will be extracted in the
reversed order with respect to the order in which they were added.
This is called stacking “LIFO”, which means “last-in-first-out”,
meaning that the last string stacked, will be the first string
extracted, i.e. reversal of the order.

Similarly, when a set of strings are stacked in the end opposite
to the end which they are later extracted from, they will be
extracted in the same order in which they were stacked. This is
referred to as “FIFO” stacking, meaning “first-in-first-out”.

The FIFO method of stacking is also sometimes referred to as
“queueing”, while the LIFO method is sometimes referred to as
“stacking” or “pushing”.



PREV NEXT