## Depth-First Search (DFS) in 2D Matrix/2D-Array – Iterative Solution

Objective: Given a two-dimensional array or matrix, Do the depth-First Search (DFS) to print the elements of the given matrix. … Read more

Objective: Given a two-dimensional array or matrix, Do the depth-First Search (DFS) to print the elements of the given matrix. … Read more

Objective: Given a stack, write a program to print the stack elements in reverse order. Example: Approach: Use Temporary stack: … Read more

Objective: Given a stack of integers, write an algorithm to sort the stack using recursion. Example: Original Stack: [14, 9, … Read more

Earlier we had discussed how to evaluate prefix expression where operands are of single-digit. In this article, we will discuss … Read more

Prefix notation is a notation for writing arithmetic expressions in which the operands appear after their operators. There are no … Read more

Objective: Given a number with N digits, write a program to get the smallest number possible after removing k digits … Read more

Objective: Given a Stack, write an algorithm to reverse the stack. Example: Original Stack: [14, 9, 67, 91, 101, 25] … Read more

Objective: Given a Prefix expression, write an algorithm to convert it into Postfix expression. Example: Input: Prefix expression: + A … Read more

Objective: Given a stack of integers, write an algorithm to sort the stack using a temporary stack. Example: Given Stack: … Read more

Objective: Given a Postfix expression, write an algorithm to convert it into Infix expression. Example: Input: Postfix expression: A B … Read more

Objective: Given a Prefix expression, write an algorithm to convert it into Infix expression. Example: Input: Prefix expression: + A … Read more

Objective: Given an Infix expression, write an algorithm to convert it into Prefix expression. Example: Input: Infix expression – A … Read more

Objective: Given an Infix expression, write an algorithm to convert it into Postfix expression. Example: Input: Infix expression – A … Read more

Infix notation is commonly used in arithmetic formula or statements, the operators are written in-between their operands. Let’s assume the … Read more

Earlier we saw about Stack and its implementation using Linked List. Java has a built in class for Stack. In … Read more