With data structures what are the implementations of using LIFO and FIFO?

Answer

Think about what each concept means.

A LIFO stack is like a supermarket queue - people are served in the order in which they arrive in line. You'd use a LIFO stack for a process that requires sequential access to data in arrival order, such as transaction processing.

On the other hand, a FIFO stack is like an elevator - the people who board last are nearest the front, so they're the first off in "processing" order. You might use a FIFO stack for something like expression parsing. For example, if you're trying to match up parens, you need to use the "nearest match" rule. That means if you have already stacked two "("s you'd want to pair the most recently-scanned one with the first closing ")" encountered and evaluate the enclosed expression. That means the ")" would pair off with the "(" at the top of your paren stack rather than the bottom; i.e. FIFO.

Improve Answer Discuss the question "With data structures what are the implementations of using LIFO and FIFO?" Watch Question

First answer by JayKay. Last edit by JayKay. Contributor trust: 875 [recommend contributor]. Question popularity: 21 [recommend question]

Research your answer:

Answers.com > Wiki Answers > Categories > Technology > Computers > Computer Programming > With data structures what are the implementations of using LIFO and FIFO?

Our contributors said this page should be displayed for the questions below. (Where do these come from)
If any of these are not a genuine rephrasing of the question, please help out and edit these alternates.
What is FIFO?  What is meant by FIFO?  How do you prepare LIFO?  Advantages of FIFO and LIFO?  Difference between lifo and fifo?  What are lifo fifo what are they used for?  What r lifo nd fifowhat they are used for?  How do LIFO and FIFO affect the cost of goods sold?  With data structures what are the implications of using LIFO and FIFO?