Difference Between Stack and Queue
Stack
|
Queue
|
---|---|
In stack the insertion and deletion operation take place only one end called top end
|
In queue insertion operation take place one end and deletion operation take place another end
|
In stack the element which is inserted last is first to delete
|
In queue the element which is inserted first is first to delete
|
Stack require only one pointer called TOP
|
Queue requires two pointers called front and rear.
|
Example : piles of trays in cafeteria
|
Example : student at registration counter
|
In stack there is no wastage of memory space.
|
In queue even if we have free memory space sometimes we cannot use that space to store elements.
|
0 comments:
Post a Comment