LIFO
From Wikipedia, the free encyclopedia
- This article is about LIFOs in computing. For the term in accounting, see LIFO accounting.
LIFO stands for last in, first out which in computer science and queueing theory refers to the way items stored in a data structure are processed. The last data to be added to the structure will be the first data to be removed. LIFO mechanisms include data structures such as stacks. Sometimes the term FILO ("first in, last out") is used synonymously.
A LIFO structure can be illustrated with the example of a crowded elevator. When the elevator reaches its destination, the last people to get on are typically the first to get off.
Another example of LIFO is an idli cooker. Idli is a dish prepared in southern part of India. It is prepared by inserting plates inside the cooker. Only the last plate kept in can be taken out first.
LIFO is also a term used in accounting, for example in determining the cost basis for inventory, and cost of goods sold. See FIFO and LIFO accounting.
[edit] See also
- Depth first search
- FIFO (First in, first out)
- Stack Data Structure