## Build Binary Tree from given Parent array

Given an array A which represents a binary tree such that the parent-child relationship is defined by (A[i], i) for every index i in the array A, build binary tree out of it.

Coding made easy

Given an array A which represents a binary tree such that the parent-child relationship is defined by (A[i], i) for every index i in the array A, build binary tree out of it.

Given a string and a dictionary of words, determine if string can be segmented into a space-separated sequence of one or more dictionary words.

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

Convert a given binary tree to BST (Binary Search Tree) by keeping original structure of the binary tree intact.

Given a normal binary tree, convert it to Left-child right-sibling (LC-RS) binary tree.

Huffman Coding (also known as Huffman Encoding) is a algorithm for doing data compression and it forms the basic idea behind file compression. This post talks about fixed length and variable length encoding, uniquely decodable codes, prefix rules and construction of Huffman Tree.

Given a binary tree, write an efficient algorithm to check if tree is height balanced or not. In a height balanced tree, the absolute difference between height of left subtree and right subtree for every node is 0 or 1.

Given a binary tree, write an efficient algorithm to print binary tree structure in standard output.

Given a BST, find ceil and floor of a given key in it. If the given key lie in the BST, then both floor and ceil is equal to that key, else ceil is equal to next greater key (if any) in the BST and floor is equal to previous greater key (if any) in …

Given a Binary Search Tree and a positive number K, find K’th smallest and K’th largest element in BST.

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

Given a BST, find in-order predecessor of a given key in it. If the given key do not lie in the BST, then return the previous greater key (if any) present in the BST. An in-order predecessor of a node in BST is the previous node in in-order traversal of it.