FIFO vs. LIFO: What is the difference?

  • By reComparison Contributor
  • comments 1
  • views11492

Difference between FIFO and LIFO

FIFO stands for First in First Out. It is nothing but a queue in which the item that enters first, leaves before any other does. We can encounter queues in many real life situations such as movie ticket counter, vehicles stopped on a traffic signal and so on. LIFO on the other hand stands for Last in First Out. It is also called a stack. A pile of books can be seen as a stack. We can see many applications of stacks in our daily lives. For example, the back button on your browser which takes you to previously opened links is but a simple application of a stack.


The implementation of stacks can be achieved by simply using an array and a variable that keeps track of the top of the stack. This variable is generally called “tos” (top of stack) and is initiated with a value -1 and is incremented every time a new entry comes into stack. This operation is called a “push” operation. Opposite to push is “pop”. A queue is also implemented with an array however in this case two variables called “rear” and “front” keep track of the queue. Every time a new value is added in a queue a “rear” is incremented. On retrieval from the queue a “front” is implemented.


Various modifications are possible in cases of queues. One of the most popular is Priority Queue. In this case, some items are assigned with higher priority than others and even above the item that should be removed as per the rules. Another modification is circular queue in which rear and front are joined. The problems of overflow can be dealt with to some extent by using such modifications. Priority can also be assigned to items in the stack that are required to be popped earlier than others.


FIFO or queue has various applications in computer science one of which is Disk Scheduling. A disc controller receives the input/output requests in a queue and schedules the disc traversal accordingly. Same is the case with processors. The computation requests from different applications are stored in a queue. Queues can also be seen in electronics communication with switches, routers and bridges. Stacks on the other hand are extremely important and the most basic data structures used in computer science. Internal recursion, a function for calling and restoring capabilities would not have been possible without the use of stacks. Stacks are also used to store the current state of a system, in case of interruptions.

Similarities and Differences


  • Last In First Out
  • Implemented using an array and a variable (tos) that keeps track of the top of stack.
  • POP and PUSH operations.
  • Recursion and function calling are implemented with the help of stacks in internal memory.


  • First In First Out
  • Two variables called “rear” and “front” keep the track of queue.
  • Circular Queue and priority queue are modifications of simple queue.
  • FIFO is used by controllers in Disk scheduling.
  • Switches, routers and bridges also use queues communication networks to temporarily store or buffer the packets.

Which concept is easier to grasp?
  • FIFO
  • LIFO

Discuss It: comments 1

  • Guest
  • FIRMWARE HACKS wrote on 2 days ago


❌ Crypro Trading, Forex Trading, Stock Trading and their likes are a means of making money but it’s more like gambling. There are no sure means to guarantee that a person could make profit with them and that’s why it can also be reasoned to be scam. Let’s not forget that some individuals even give you 💯 % guarantee of making profits and end up running away with your money.

❌ You might have also come across some individuals that say they will give you guarantee on successful trades but they only end up as SCAMMERS as well. You here them say stuffs like 200% guaranteed in just 2 weeks and when you go into trade with them, they start telling you to pay profits percentage before you can get your income. These are all liars please avoid them. But if you have been a victim of this guys, then you should contact FIRMWARE now‼️

The internet today is full of Recovery Scam, you see so much testimonies been shared about how a firm or Company helped them recover what they lost to this Trading, but believe it, it’s just a way to lure more people and end up scamming them.

✳️The big Question is “Can someone Recover their money lost to Binary Option and Scam⁉️

I will say yes, and will tell you how.

The only way to Recovery your money back is by hiring HACKERS to help you break into the Firms Database Security System using the information you provide them with, Extract your file and get back your money. It seems like a really impossible thing to do, I will tell you, it should be impossible, but with the use of specially designed softwares known to HACKERS and Authorities (such as The FBI, CIA e.t.c) it is possible and the only way to recover your money.

✅FIRMWARE are a group of hackers who use their hacking skill to hunt down SCAMMERS and help individuals recovery their money from Internet SCAMMERS.

We just need the contact details of the SCAMMERS and Paymnet Info and within 4-8 hours your money will be return to you.

This are services we offer-:

🟢Crypto scam money recovery

🟢lost loan money recovery

🟢money laundry recovery

🟢Device hack

🟢Bank issues

🟢Access to school/company/fellowship/organization files

🟢Lost cars tracking

🟢fraud payment

🟢Access to cheating husband/wife device

🟢extending and subtracting of stamped file concerning a giving end line period of time

🟢tracing and recovering lost emails/conversations/contacts / and accessories


✳️ You can contact us via the emails below-:


2022 All right reserved ®️

Post a Comment
  • Name*
  • Email*
  • Website (optional)
  • arrow You are commenting as a Guest
  • arrow Your email will not be public
  • arrow Login or Sign Up and post using your reComparison account
  • arrow Facebook Connect