CH-3 Stack and Queue .
[ Explain Stack data Structure in detail.]
Answers
Answered by
0
Basically Stack is a data structure called last-in, first-out (LIFO) in which insertion and deletion of elements are done at only end(which basically known as top of stack)
On other hand Queue is a first-in, first-out(FIFO) data structure in which the element that is inserted first, that first element has to take out first. The element in a queue are added at one end called the rear and removed from the other end called the front.
Stack has 3 operations
- Push(insert an element in to stack)
- Pop(delete the topmost element from stack)
- Peek(It returns the value of the topmost element of the stack without deleting it from the Stack)
Queue has basic 2 operations
- Enqueue or Insert
- Dequeue or Delete
There are 4 Type of queues but thats not required for school level still I'm providing their names
- Circular Queue
- Deque
- Priority Queue
- Multiple Queue
Attachments:
Similar questions