Ads

Saturday, 25 February 2017

Stack and Queue

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)

No comments:

Post a Comment

SOLID Principles

SOLID principles are the basic essential thing to know for every developer before he/she starts coding in any IDE. Here is the full form S ...