## Delete a Binary Tree | Iterative & Recursive

Given a binary tree, write an efficient algorithm to delete entire binary tree.   The program should de-allocate every single node present in the tree, not just change reference of the root node to null.     The idea is to traverse the tree in post-order fashion and delete left and right subtree of a …

## Calculate height of binary tree | Iterative & Recursive

Write an efficient algorithm to compute the height of binary tree. The height or depth of a tree is number of edges or nodes on longest path from root node to leaf node.   The program should consider number of nodes in the longest path. For example, height of an empty tree is 0 and …

## 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 …

## Find Optimal Cost to Construct Binary Search Tree

Find optimal cost to construct binary search tree where each key can repeat several times. We are given frequency of each key in same order as corresponding keys in inorder traversal of a binary search tree.

## Find Duplicate Rows in a Binary Matrix

Find duplicate rows present in a given binary matrix by traversing the matrix only once.

## Find first k maximum occurring words in given set of strings

Given a huge set of strings with duplicate strings present, find first k-maximum occurring words in it.

## Find maximum occurring word in given set of strings

Given a huge set of strings with duplicate strings present, find the maximum occurring word in it. If two words have same count, return any one of them.

## Lexicographic sorting of given set of keys

Lexicographic sorting: Given a set of strings, print them in Lexicographic order (dictionary/alphabetical order).

## Longest Common Prefix in given set of strings (using Trie)

Find Longest Common Prefix (LCP) in given set of strings.

## Memory efficient Trie Implementation in C++ using Map | Insert, Search and Delete

In this post, we will cover memory efficient Trie implementation in C++ using map data structure.

## Trie Implementation in C | Insertion, Searching and Deletion

Implement insert, search and delete operations on Trie Data structure. Assume that input consist of lowercase letters a-z.

## Determine if an undirected graph is a Tree (Acyclic Connected Graph)

Given an undirected graph, check if is is a tree or not. In other words, check if given undirected graph is a Acyclic Connected Graph or not.