## Merging and Sorting Two Unsorted Stacks

Given 2 input stacks with elements in an unsorted manner. Problem is to merge them into a new final stack, such that the elements become… Read More »

Given 2 input stacks with elements in an unsorted manner. Problem is to merge them into a new final stack, such that the elements become… Read More »

Given a bracket sequence or in other words a string S of length n, consisting of characters ‘(‘ and ‘)’. Find length of the maximum… Read More »

Given an array a[1..N]. For each element at position i (1 <= i <= N). Where L(i) is defined as closest index j such that… Read More »

Given a Queue consisting of first n natural numbers (in random order). The task is to check whether the given Queue elements can be arranged… Read More »

Given an array of elements, task is to sort these elements using stack. Prerequisites : Stacks Examples : Input : 8 5 7 1 9… Read More »

Given a binary tree, print the level order traversal in such a way that first two levels are printed from left to right, next two… Read More »

Given a string that contains only the following => ‘{‘, ‘}’, ‘(‘, ‘)’, ‘[’, ‘]’. At some places there is ‘X’ in place of any… Read More »

Given an array arr[] and a number k. The task is to delete k elements which are smaller than next element (i.e., we delete arr[i]… Read More »

Given a stack with push(), pop(), empty() operations, delete middle of it without using any additional data structure. Input : Stack[] = [1, 2, 3,… Read More »

Given an expression exp of length n consisting of some brackets. The task is to print the bracket numbers when the expression is being parsed.… Read More »

Infix : An expression is called the Infix expression if the operator appears in between the operands in the expression. Simply of the form (operand1… Read More »

Prefix : An expression is called the prefix expression if the operator appears in the expression before the operands. Simply of the form (operator operand1… Read More »

Postfix: An expression is called the postfix expression if the operator appears in the expression after the operands. Simply of the form (operand1 operand2 operator).… Read More »

Infix expression: The expression of the form a op b. When an operator is in-between every pair of operands. Postfix expression: The expression of the… Read More »

Given a binary tree. Modify it in such a way that after modification you can have a preorder traversal of it using only the right… Read More »