what LIFO means and which data structure follows the LIFO strategy ?
+9
A:
"Last in first out"
The classic example is a stack - if you push A, B, C then you'll pop C, B, A in that order.
Compare that with "first in first out" (FIFO) where the classic example is a queue. If you enqueue A, B, C then you'll dequeue A, B, C in that order.
Jon Skeet
2009-06-23 20:54:31
Always reminds me of Magic the Gathering effects rules :)
Russ Cam
2009-06-23 21:04:34
+2
A:
LIFO means Last In First Out
A stack is probably the best example. You get two main operations: push, pop.
If
push(firstItem);
push(secondItem);
push(thirdItem);
Then
pop();
pop();
pop();
would return thirdItem, secondItem, then firstItem.
Justin Niessner
2009-06-23 20:54:55
A:
common LIFO structures in the wild: a plate dispenser at a buffet. The last plate inserted onto the stack is the first to come out.
leadingzero
2009-06-23 21:01:43
But if consumed correctly parts from multiple pancakes nibbles are contained per bite.
Matthew Whited
2009-06-24 16:33:55
A:
patience padawan. all will be revealed in due time.
computer science's existence is almost based on Last in first Out! everytime a program runs it uses a stack. countless algorithms use it.
Victor
2009-06-23 21:03:38