Author: admin

Add Two Matrix

“Add Two Matrix” is a basic operation which can be applied over two or more matrices. Here, we have given two matrices of dimension N*M and our task is to add the following matrices and store the result in resultant matrix. CONDITION: The dimensions of the matrices to be added...

Merge Overlapping Intervals

“Merge Overlapping Intervals” is a standard application of stack data structure. Here, we have given set of intervals and our task is to merge all overlapping intervals and then print the resultant non-overlapping intervals. Example: The set of intervals are: (1,4) , ( 2,5) , (7,8) , ( 6,9). After merging...

Implement Queue Using Stacks

“Implement Queue using Stacks” is a classic interview problem based on stack and queue data structures. Here, we have given two stacks and our task is to implement queue using these two stack.  Stack contains basically two operations, including:  push and pop. To implement queue using given two stacks, we need to perform some...

blank

Next Greater Element

“Next Greater Element” is a classic interview problem based on stack data structure. Here, we have given an array with ‘n’ elements. Our task is to print next greater element of each element of an array. If there is no greater element for any element in an array, simply print...

blank

Check for balanced parentheses

“Check for balanced parentheses” is one of an ideal application of stack data structure. Here, we have given a parentheses string and our aim is to check whether the given string is balanced parentheses string or not.  Balanced parentheses strings are those strings who have closing parentheses like }, ], ) for each...

blank

Postfix to Prefix Conversion

“Postfix to Prefix Conversion” is a classic example of  stack data structure. Stack can be used to convert given postfix expression to corresponding prefix expression. Operator: Operator are symbols that instruct the computer to perform simple and single tasks. Examples of operators includes + (Addition), – (Subtraction), * (multiplication),… and many...

blank

Postfix to Infix Conversion

“Postfix to Infix conversion” is a classic example of  stack data structure. Stack can be used to convert given postfix expression to corresponding infix expression. Operator: Operator are symbols that instruct the computer to perform simple and single tasks. Examples of operators includes + (Addition), – (Subtraction), * (multiplication),… and many...

blank

Prefix to Postfix Conversion

“Prefix to postfix conversion” is a classic example of  stack data structure. Stack can be used to convert given prefix expression to corresponding postfix expression. Operator: Operator are symbols that instruct the computer to perform simple and single tasks. Examples of operators includes + (Addition), – (Subtraction), * (multiplication),… and many...

blank

Prefix to Infix Using Stack

“Prefix to Infix Using Stack” is a classic example of  stack data structure. Stack can be used to convert given prefix expression to corresponding infix expression. Operator: Operator are symbols that instruct the computer to perform simple and single tasks. Examples of operators includes + (Addition), – (Subtraction), * (multiplication),… and...