Stack and Queue, both are abstract data structures.
Stack
It follows LIFO(Last In First Out)
The stack basic operations are
1. Push (adds an element at the end)
2. Pop (removes an element from the end)
3. Peek (reads the top element in the stack)
4. isFull (checks whether the stack is full or not)
5. isEmpty (checks whether the stack is empty or not)
Queue
It follows FIFO(Fisrt In First Out)
The stack basic operations are
1. enqueue (adds an element to the queue)
2. dequeue (removes an element to the queue)
3. Peek (reads the top element in the stack)
4. isFull (checks whether the stack is full or not)
5. isEmpty (checks whether the stack is empty or not)
Stack
It follows LIFO(Last In First Out)
The stack basic operations are
1. Push (adds an element at the end)
2. Pop (removes an element from the end)
3. Peek (reads the top element in the stack)
4. isFull (checks whether the stack is full or not)
5. isEmpty (checks whether the stack is empty or not)
Queue
It follows FIFO(Fisrt In First Out)
The stack basic operations are
1. enqueue (adds an element to the queue)
2. dequeue (removes an element to the queue)
3. Peek (reads the top element in the stack)
4. isFull (checks whether the stack is full or not)
5. isEmpty (checks whether the stack is empty or not)
No comments:
Post a Comment