## Insertion in BST | Recursive & Iterative Solution

A Binary Search Tree (BST) is a rooted binary tree, whose nodes each store a key (and optionally, an associated value) and each have two distinguished sub-trees, commonly denoted left and right. The tree should satisfy the BST property, which states that the key in each node must be greater than all keys stored …

## In-place convert convert given Binary Tree to Doubly Linked List

Given a binary tree, in-place convert it to a Doubly Linked List.

## Print all paths from leaf to root node in a binary tree

Given a binary tree, write an recursive algorithm to print all paths from leaf to root node in a binary tree.

## Find Lowest Common Ancestor (LCA) of Two Nodes in a Binary Tree

Given a binary tree and two nodes x and y in it, find lowest common ancestor (LCA) of x and y in it.

## Check if a Binary Tree is Symmetric or not

Given a binary tree, write an efficient algorithm to check if it is symmetric binary tree or not. i.e. left subtree and right subtree are mirror images or each other.

## Find Diameter of a Binary Tree

Given a binary tree, write an efficient algorithm to compute the diameter of it. The diameter of a binary tree is equal to number of nodes on the longest path between any two leaves in it.

## In-place convert given binary tree to its sum tree

Given a binary tree, in-place convert it to its sum tree. In a sum tree, value at each node is equal to the sum of all elements present in its left and right subtree. The value of an empty node is considered as 0.

## Find next node in same level for given node in a binary tree

Given a binary tree and a node in it, write an efficient algorithm to find its next node in same level as given node.

## Reverse Level Order Traversal of Binary Tree

Given a binary tree, print its nodes level by level in reverse order. i.e. all nodes present at last level should be printed first followed by nodes of second-last level and so on.. All nodes for any level should be printed from left to right.

## Spiral Order Traversal of Binary Tree

Given a binary tree, print its nodes level by level in spiral order. i.e. all nodes present at level 1 should be printed first from left to right, followed by nodes of level 2 right to left, followed by nodes of level 3 from left to right and so on.. In other words, odd levels …

## Level Order Traversal of Binary Tree

Given a binary tree, print its nodes level by level. i.e. all nodes present at level 1 should be printed first followed by nodes of level 2 and so on.. All nodes for any level should be printed from left to right.

## 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 …
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}