Thursday, 28 September 2017

Differentiate between LIFO and FIFO data-structures. 

First In First Out data structures:

It is a data-structures in which we work on the First In First Out method. In this method element which entered first into the it is the first element to be deleted from it. The data structure which applied these method are known as Queues. Queues are implemented with array or linked lists linear data structure and used for many application areas. There are different types of Queues we have in data structure like simple queues, circular queues, priority queues etc. Queues can not be used for recursion. To implement a queue two different pointers are needed- front pointer variable which is used for first element and rear which points to the last element of the queues. 

Last In First Out data structures:


It is a data-structures which work on the principle of last in first out method. The element which is entered last is popped out first. In this case, both insertions and deletions take place from the on end. Stacks are LIFO type of data-structures. They are used in recursion. Like queues, stacks are also implemented in the form of arrays or linked lists. To implement stacks a single pointer is used which is called top variable. 

**********************************

Thanks
Mukesh Rajput

No comments:

Post a Comment

Thanks
Mukesh Rajput