Check if two binary trees are identical or not | Iterative & Recursive

Write an efficient algorithm to check if two binary trees are identical or not. i.e. if they have identical structure & their contents are also same.     The idea is to traverse both trees and compare value at their root node. If the value matches, we recursively check if left subtree of first tree …

Stack implementation in Java

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.

Stack Implementation using Templates in C++

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.  

Stack Implementation in C++

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.

Stack implementation using linked list (in C and Java)

  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.

Stack Implementation in C

  A stack is a linear data structure that serves as a collection of elements, with three main operations: