The basic difference between stack and queue, is the way they behave. Stack is known as LIFO (Last in First Out), while queue is FIFO (First in First Out). The first element that will get out of stack is the element that was inserted last, while the first element that will come out of queue is the element that goes in first.
2007-02-16 17:48:58
·
answer #1
·
answered by manoj Ransing 3
·
0⤊
0⤋
hello friend stack uses the technique of last-in-first-out LIFO,ex:bucket(the last dress u placed in it to wash will be taken out first)queue uses the technique of first-in-first-out FIFO,ex: queues in theatres(the man who goes into the queue first receives the ticket first).but both have the similar properties of storing the values.stack has one pointer only top.queue has two pointers front,rear.when u give an element to stack its top increments by one.Enqueue means adding a new item to the rear of the queue while dequeue refers to removing the front item from the queue and returning it to the calling entity.for some other details go to wikipedia web site and have a search
2007-02-16 18:48:31
·
answer #2
·
answered by kunnu 3
·
0⤊
0⤋
They differ in the way data elements are stored in and retrieved from them. Stack follows the LIFO policy - Last In First Out - which means the last data element to be stored (Pushed) will be the first one to be taken out (Popped out). Queue follows the FIFO policy - First In First Out.
2007-02-16 18:03:57
·
answer #3
·
answered by Anonymous
·
0⤊
0⤋
STACK: LAST IN FIRST OUT
QUEUE: FIRST IN FIRST OUT
2007-02-16 23:42:21
·
answer #4
·
answered by Gaurav M 1
·
0⤊
0⤋