Posts

C++: Binary Tree using STL

Image
In computer science, a binary tree is a tree data structure in which each node has at most two children, which are referred to as the left child and the right child. 

SPOJ Problem - CPTTRN6 - Character Patterns (Act 6)

This is a problem from SPOJ. We have to print a character pattern according to the input given.

We have input

33 1 2 1 4 4 1 2 2 5 3 2

SPOJ Problem - CPTTRN5 - Character Patterns (Act 5)

This is a problem from SPOJ. We have to print a character pattern according to the input given.

We have input 

33 1 24 4 12 5 2

C++: Huffman Coding using STL

Image
Huffman Code compress data very effectively: saving of 20% to 90% are typical, depending on the characteristics of the data being compressed.Huffman's greedy algorithm uses a table giving how often each character occurs (i.e., its frequency) to build up an optimal way of representing each character as a binary string. This algorithm constructs an optimal prefix code called a Huffman Code.

C++: Maximum Priority Queue

Image
In a Priority Queue, an element with high priority is served before an element with low priority. If two elements have the same priority, they are served according to their order in the queue.

While priority queues are often implemented with heaps, they are conceptually distinct from heaps. [Wikipedia]

Popular Posts

Top 10 Web Sites Every Programmer Should Visit Daily

What is "namespace" and why do we use it?