Prerequisite – FIFO (First-In-First-Out) approach in Programming

**FIFO** is an abbreviation for **first in, first out**. It is a method for handling data structures where the **first element** is processed first and the **newest element** is processed last.

**Real life example:**

**LIFO** is an abbreviation for **Last in, first out** is same as fist in, last out (FILO). It is a method for handling data structures where the **last element** is processed first and the **first element** is processed last.

**Real life example:**

**Below is a comparison of FIFO vs. LIFO:**

FIFO | LIFO |
---|---|

It stands for First-In-First-Out approach in programming. | It stands for Last-In-First-Out approach in programming. |

In this, the new element is inserted below the existing element, So that the oldest element can be at the top and taken out first. | In this, the new element is inserted above the existing element, So that the newest element can be at the top and taken out first. |

Therefore, the First element to be entered in this approach, gets out First. | Therefore, the First element to be entered in this approach, gets out Last. |

In computing, FIFO approach is used as an operating system algorithm, which gives every process CPU time in the order they arrive. | In computing, LIFO approach is used as a queuing theory that refers to the way items are stored in types of data structures. |

The data structure that implements FIFO is Queue. | The data structure that implements LIFO is Stack. |

## Recommended Posts:

- LIFO (Last-In-First-Out) approach in Programming
- FIFO (First-In-First-Out) approach in Programming
- What is Competitive Programming and How to Prepare for It?
- Improving Linear Search Technique
- Count number of times each Edge appears in all possible paths of a given Tree
- Count of root to leaf paths in a Binary Tree that form an AP
- Count of elements on the left which are divisible by current element | Set 2
- Count of triplets in an Array (i, j, k) such that i < j < k and a[k] < a[i] < a[j]
- Print sublist of a given Linked List specified by given indices
- Comparison between Lists and Array in Python
- Real-time application of Data Structures
- C program to implement Adjacency Matrix of a given Graph
- Sum of all Palindrome Numbers present in a Linked list
- Sum of all perfect numbers present in an Linked list

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.