Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A simple Huffman compression program in C++
C++
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
string
README
createMapping.cpp

README

Huffman_Compression

This will be a simple Huffman compression program.
There will be two command line programs. One to take
a file and build a mapping between ascii and the
compressed code and another to use that mapping
to do compression and depcompression.

    _________________________________________________________________________________
    | High level diagram                Ascii File                                  |
    |  Boxes are programs                   |                                       |
    |                                       v                                       |
    |                       ---------------------------------                       |
    |                       |         createMapping         |                       |
    |                       |                               |                       |
    |                       |                               |                       |
    |                       |                               |                       |
    |                       ---------------------------------                       |
    |                                       | Mapping file                          |
    |                                       v                                       |
    |                       ---------------------------------                       |
    |                       |           compress            |                       |
    |                       |                               |<---Ascii file         |
    |                       |                               |<---Binary file        |
    |                       |                               |                       |
    |                       ---------------------------------                       |
    |                                |              |                               |
    |                                v              v                               |
    |                           Binary file     Ascii file                          |
    |_______________________________________________________________________________|


                                           | |
                                           | |
                                          \   /
                                           \ /


                                        Ascii file
                                            |
                                            v
    ________________________________________-________________________________________
    | createMapping                         |                                       |
    |                                       v                                       |
    |                       ---------------------------------                       |
    |                       |     buildFrequencyTable       |                       |
    |                       |                               |                       |
    |                       |                               |                       |
    |                       ---------------------------------                       |
    |                                       | array or list                         |
    |                                       v                                       |
    |                       ---------------------------------                       |
    |                       |         createHuffMap         |                       |
    |                       |                               |                       |
    |                       |                               |                       |
    |                       ---------------------------------                       |
    |                                       |  file describing map                  |
    |                                       |                                       |
    |_______________________________________________________________________________|
                                            |
                                            |
                                            v
    _________________________________________________________________________________
    |  compress                             |                                       |
    |                                   check flag                                  |
    |                       case 0          |           case 1                      |
    |                       ----------------o---------------                        |
    |                       |           -------------------|---------------------   |
    |                       v           v                  v                    |   |
    |       --------------------------------  ------------------------------    |   |
    |       |           compress           |  |        uncompress          |    |   |
    |       |                              |  |                            |<-------|<-file
    |       |                              |  |                            |        |
    |       --------------------------------  ------------------------------        |
    |                       |                               |                       |
    |                       ----------------o----------------                       |
    |                                       |                                       |
    |_______________________________________________________________________________|
                                                | file
                                                v
Something went wrong with that request. Please try again.