Stack and a Queue

<<Previous Next>> 
Data structure  - What is the difference between a stack and a Queue? - Feb 27, 2010, 11:15 am by Rajmeet Ghai

What is the difference between a stack and a Queue?

Stack is a collection of objects that works in LIFO (Last in First out) mechanism while Queue is FIFO (First in First out). This means that the object that is inserted first is removed last in a stack while an object that is inserted first is removed first in a queue.

Data structure  - What is the difference between a stack and a Queue? - July 31, 2009, 10:55 am by Vidya Sagar

What is the difference between a stack and a Queue? 

Stack – Represents the collection of elements in Last In First Out order. 
Operations includes testing null stack, finding the top element in the stack, removal of top most element and adding elements on the top of the stack.

Queue - Represents the collection of elements in First In First Out order.
Operations include testing null queue, finding the next element, removal of elements and inserting the elements from the queue. 
Insertion of elements is at the end of the queue
Deletion of elements is from the beginning of the queue. 

<<Previous Next>> 

Write your comment - Share Knowledge and Experience

Discussion Board
Difference between stack and queue

Stack is a structure of data that is based on LIFO ( last in first out )
on the other hand queue is a structure that is based on FIFO( FIRST IN FIRST OUT)

IN the stack the new item is inserted with push method and deleted with pop method

on the other hand in the queue the new item is inserted with enqueue method and deleted with dequeue method.

Sandeep khandelwal 04-3-2014 02:07 AM

 

 

 
Latest placement tests
Latest links
 
 
Home | Want a Job? Submit Key Skills | Employer login | My key skills | About us | Sitemap | Contact us