Open In App

LIFO Full Form

LIFO stands for Last In First Out. LIFO was developed as an alternative to the base stock method in inventory accounting and meant that the most recently sold items were recorded as sold first.



In technical terms, LIFO means that the element which was stored as the last element will be the first to be removed. It happens so because the new element will be inserted above the existing element and thus the newest element will be available at the top and it will be removed. Thus, the oldest element or the element that was encountered first during this operation will get out last as it will be at the bottom.

Example:


Here, a stack of CDs is available. Now, if we remove the topmost CD, we will be able to access the CD just below it. But if we want to access the CD at the bottom of the stack, we will have to remove all the CDs above it. This will be the only way to access the bottom-most CD.



Characteristics of LIFO

The following general operations are carried out on the Stack data structure

Advantages

Disadvantages

Article Tags :