0 votes

When dealing with Data Structure there comes stack and queue, what are they? Why and where are they implemented?

asked Feb 3 in Computer Science - IT by dikshitadithya | 11 views

1 Answer

+2 votes

Stack and Queue both are the non-primitive data structures. The main differences between stack and queue are that stack uses LIFO (last in first out) method to access and add data elements whereas Queue uses FIFO (First in first out) methoStack has only one end open for pushing and popping the data elements on the other hand Queue has both ends open for enqueuing and dequeuing the data elements.

Stack and queue are the data structures used for storing data elements and are actually based on some real world equivalent. For example, the stack is a stack of CD’s where you can take out and put in CD through the top of the stack of CDs. Similarly, The queue is a queue for Theatre tickets where the person standing in the first place, i.e., front of the queue will be served first and the new person arriving will appear in the back of the queue (rear end of the queue).d to access and add data elements.

answered Feb 8 by Shivam Chauhan