A stack is a linear data structure which follows the LIFO (last-in first-out) principle. That means the objects can be inserted or removed only at one end of it also called as top.
In previous post, we have discussed C++ implementation of stack data structure using classes. In this article, we will make code generic for all data-types by using C++ templates.
Write code to efficiently evaluate given postfix expression.
Given an balanced expression that can contain opening and closing parenthesis, check if the expression contains any duplicate parenthesis or not.
Given an string containing opening and closing braces, check if it represents a balanced expression or not.
A stack is a linear data structure that serves as a container of objects that are inserted and removed according to the LIFO (last-in first-out) rule.
A stack is an linear data structure that serves as a collection of elements, with three main operations: push, pop and peek. We have discussed about these operations in previous post and covered array implementation of stack data structure. In this post, linked list implementation of stack is covered.
A stack is a linear data structure that serves as a collection of elements, with three main operations:
Depth first search (DFS) is an algorithm for traversing or searching tree or graph data structures. One starts at the root (selecting some arbitrary node as the root in the case of a graph) and explores as far as possible along each branch before backtracking.
Write an iterative program to reverse a string in C++ and Java.
In this post, we will discuss various methods to iterate through Stack in Java.
In this post, we will discuss various methods to iterate over Deque in Java.