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.

Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Stumbleupon Share on Tumblr Share on Reddit Share on Diggit

You may also like this!