Category: Tree

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.

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.