Design the forward and backward buttons of a Browser using Stack Data Structure. If at any instance, the URL does not exist after pressing any… Read More

# Category Archives: Stack

Tarjan’s Algorithm: The Tarjan’s Algorithm is an efficient graph algorithm that is used to find the Strongly Connected Component(SCC) in a directed graph by using… Read More

Given a binary string S , the task is to find the smallest string possible by removing all occurrences of substrings “01” and “11”. After… Read More

The Stack is a linear data structure that follows the LIFO(Last In First Out) principle, i.e, the element inserted at the last is the element… Read More

Given two integers S and N, the task is to find the maximum possible sum of squares of N integers that can be placed in… Read More

Given an array of strings Q[], consisting of queries of the following types: “WRITE X”: Write a character X into the document. “UNDO”: Erases the… Read More

Given a Stack S, the task is to print the elements of the stack from top to bottom such that the elements are still present… Read More

Given a Binary Search Tree, the task is to print the nodes of the BST in the following order: If the BST contains levels numbered… Read More

Given an array arr[] of size N, the task is to print the distance of every array element from its next greater element. For array… Read More

Given an undirected graph G with N nodes, M edges, and an integer K, the task is to find the maximum count of edges that… Read More

In a multi-threaded environment, the lock-free algorithms provide a way in which threads can access the shared resources without the complexity of Locks and without… Read More

Given a stack of integers S and an array of integers arr[], the task is to check if all the array elements are present in… Read More

Given a string, str, the task is to remove all the duplicate adjacent characters from the given string. Examples: Input: str= “azxxzy”Output: ay Removal of “xx”… Read More