For the implementation of the Pushdown automata for checking the string is accepted from the machine is not, the stack data structure is used.Also, the LIFO principle is used in a heap and filling the activation records of the program while executing it.Recursion is used to solve the problem more efficiently. Its main application is the implementation of recursion.For the evaluation of the various expressions like postfix to infix, infix to prefix, and prefix to postfix, stack plays a very important role.Most of the programs are based on the concept of LIFO.The stack contains only one end, or we can say it is open-ended from one side only.The data element that is pushed recently in the stack will be popped out first similarly, vice-versa, the data element that is pushed into the stack initially will be popped out last until we pop out all the elements present before it.In the stack data structure, we will perform the main two operations: first is push, and another is pop.The data structure, based on the LIFO principle, is stack.It is an interesting game and wholly based on the last in the first out principle. The number of books placed one over anotherĪnother best example real-life example is the Tower of Hanoi. It means that the last element will be the first to be popped out. Here, we will pop out the data elements which are recently added. The word LIFO stands for Last In First Out, in which we will enter the data elements into the data structure. Next → ← prev LIFO Approach in data structure
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |