**In this module, we will cover**

- The core idea behind the Stack
- Fundamental operations of a Stack
- Array implementation of a Stack in c++
- Explanation of code

Stack implements LIFO( last in first out ) or FILO( first in last out ) policy.

### Fundamental operations

- push ( equivalent to insert ): data is inserted at the top position
- pop ( equivalent to delete ): deletes the most recently inserted element

Let's consider the spring-loaded stacks of plates used in cafeterias, the order in which plates are popped from the stack is the reverse of the order in which they are pushed onto the stack since only the top plate is accessible.

That's all for this article, after completing Linked List we will implement this again using a Linked list. In the next article, we will discuss the

So, for now, practice the above problems and

**Array implementation of stack**

#### Basic operations :

- push( x ) : insert element x at the top of a stack
- pop( ) : removes an element from the top of a stack
- topElement( ) : access the top element of a stack
- isEmpty( ) : check whether a stack is empty
- size( ) : determines the current size of a stack

#### Code :

#### Explanation of code :

### Practice Problems

- Balanced Brackets ( HackerEarth )
- Stack and Queue ( HackerEarth )
- Minimum add to make parenthesis valid ( HackerEarth )
- Equal Stacks ( Hackerrank )
- Game of two stacks ( Hackerrank )

**Queue**.

So, for now, practice the above problems and

**if you get stuck then ask your questions through comment section**or if you have

**any content**related to the topics discussed above and want to add here, then you can mention in the comment section for which we will be thankful to you.

Thank You for Reading

## Comments

## Post a Comment

If you have any doubt, then please feel free to ask.