-
Data storage is one of the most cruicial aspects of all the electronic devices in use today.
-
Given how every device has a finite storage capacity, this limits the amount of data a user can store.
-
Using the Huffman Coding Algorithm, we have programmed a Text File Compressor.
-
The programme will take input text from the user and compress it.
-
Compressing will allow us to store the same input text in a lesser space by utilising various data structures while ensuring data integrity.
-
Upon decompression, the encoded user data will be displayed as the original text and also show the % space saved by the user after compression.
-
Priority Queue
-
Unordered Map
-
Vector
-
Binary Heap
-
Get the frequency of each character from the input text
-
Build Huffman Tree and assign the binary code to each character
-
Compression: Encode each character of the input text with the binary code
-
Decompression: Decode by replacing each binary code with the associated character
-
Unordered Maps from the STL are utilised in storing the characters and their frequencies
-
Priority queue is crucial while generating the Huffman Tree as the algorithm depends on the priority order of the characters
-
Vectors from the STL are required to keep track of nodes and assist the priority queue