## C++ Implementation of Trie Data Structure

In this post, we will discuss C++ implementation of Trie Data Structure which supports insertion, deletion and search operations.

## Find all words matching a pattern in the given dictionary

Given a dictionary of words where each word follows a CamelCase notation, find all words in the dictionary which matches with the given pattern consisting of all uppercase characters.

## Construct a Binary Tree from Ancestor Matrix

Given an ancestor matrix, whose cell (i, j) has value true if i is ancestor of j in a binary tree, construct a binary tree from it where binary tree nodes are labelled from 0 to n-1 where n is the size of the ancestor matrix.

## Calculate height of a binary tree with leaf nodes forming a circular doubly linked list

Write an algorithm to compute the height of a binary tree with leaf nodes forming a circular doubly linked list where the left and right pointers of the leaf node will act as a previous and next pointer of circular doubly linked list respectively.   For example, consider below binary tree. The leaf nodes are …

## Replace every element of an array with the least greater element on its right

Write an efficient algorithm to replace every element of a given array with the least greater element on its right or with -1 if there are no greater element.

## Huffman Coding Compression Algorithm

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.

## Check if given Binary Tree is Height Balanced or not

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.

## Treap Data Structure

A Treap Data Structure is basically a combination of a binary search tree and a heap.   Binary Search Trees – Deletions and additions of nodes can make the tree unbalanced (heavier on sides, therefore, the property we value about BSTs, the ability to distribute data by equal divisions, goes out of whack). Therefore we …

## Implement Trie Data Structure in Java

Trie is a tree-based data structure used for efficient retrieval of a key in a huge set of strings. In this post, we will implement Trie data structure in Java.

## Print Binary Tree Structure with its contents in C++

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

## Floor and Ceil in a Binary Search Tree

Given a BST, find floor and ceil 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 …

## Find K’th smallest and K’th largest element in BST

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