What is Data Compression? Data compression is the process of reducing the size of a file or data stream. This is done to save storage space or reduce transmission time.

Why Compress Data?

Types of Data Compression

Huffman Coding

What is Huffman Coding?

Huffman coding is a method of lossless data compression. It uses variable-length codes to represent characters, with shorter codes assigned to more frequent characters.

How do I make a Huffman tree?

Let’s try to encode the string "AQA Extreme Exams" into Huffman coding.

Step 1: Start with a list of characters and their frequencies.

Character Frequency
A 2
E 2
<Space> 2
x 2
e 2
m 2
Q 1
t 1
r 1
s 1
a 1