## Invert given Binary Tree | Recursive and Iterative solution

Given a binary tree, write an efficient algorithm to invert binary tree.

Coding made easy

Given a binary tree, write an efficient algorithm to invert binary tree.

Given a set of intervals, print all non-overlapping intervals after merging overlapping intervals.

Given a sequence consisting of ‘I’ and ‘D’ where ‘I’ denotes increasing sequence and ‘D’ denotes the decreasing sequence. Decode the given sequence to construct minimum number without repeated digits.

Given a binary tree, find all ancestors of given node in it.

Given a binary tree, write iterative and recursive solution to traverse the tree using in-order traversal. Unlike linked lists, one-dimensional arrays and other linear data structures, which are traversed in linear order, trees may be traversed in multiple ways in depth-first order (in-order, pre-order and post-order) or breadth-first order (level order traversal). Beyond these …

Given a binary tree, write iterative and recursive solution to traverse the tree using pre-order traversal. Unlike linked lists, one-dimensional arrays and other linear data structures, which are traversed in linear order, trees may be traversed in multiple ways in depth-first order (pre-order, pre-order and pre-order) or breadth-first order (level order traversal). Beyond these …

Given a binary tree, write iterative and recursive solution to traverse the tree using post-order traversal. Unlike linked lists, one-dimensional arrays and other linear data structures, which are traversed in linear order, trees may be traversed in multiple ways in depth-first order (post-order, pre-order and post-order) or breadth-first order (level order traversal). Beyond these …

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 …

Given a line of text, reverse the text without reversing the individual words.

Given a binary pattern that contains ‘?’ wildcard character at few positions, find all possible combinations of binary strings that can be formed by replacing the wildcard character by either 0 or 1.

Write iterative version of recursive Quick Sort algorithm.

This article covers the 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.