Stack:
Aim 1: Write a C++ program to perform push operation and pop operation and top
element in a stack and display the
output.
Aim 2: Given a stack s, remove the middle element of it without using any additional
data structure.
Example :
Input: s = [10, 20, 30, 40, 50]
Output: s = [10, 20, 40, 50]
Aim 3 : Given an array arr[] of integers, determine the Next Greater Element
(NGE) for every element in the array, maintaining the order of appearance.
● The Next Greater Element for an element x is defined as the first element
to the right of x in the array that is strictly greater than x.
● If no such element exists for an element, its Next Greater Element is -1.
Examples:
Input: arr[] = [1, 3, 2, 4]
Output: [3, 4, 4, -1]
Aim 4: Given a Postfix expression, convert it into a Prefix expression using stack
Examples:
Input : Postfix : AB+CD-*
Output : Prefix : *+AB-CD
Aim 5: Write a C ++ program to reverse a string using stack.