{"id":15502892,"url":"https://github.com/amicks/huffman-coding","last_synced_at":"2025-07-01T01:34:52.874Z","repository":{"id":102454633,"uuid":"94139528","full_name":"amicks/Huffman-Coding","owner":"amicks","description":"Utilizes Huffman's lossless data compression algorithm to encode/decode files.  Final project in CMPS12B.","archived":false,"fork":false,"pushed_at":"2017-09-04T00:07:23.000Z","size":730,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-19T17:29:37.979Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amicks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-12T20:55:33.000Z","updated_at":"2017-09-04T00:10:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"6b5a94d9-a48f-463b-ab72-be4241c3feed","html_url":"https://github.com/amicks/Huffman-Coding","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/amicks/Huffman-Coding","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amicks%2FHuffman-Coding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amicks%2FHuffman-Coding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amicks%2FHuffman-Coding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amicks%2FHuffman-Coding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amicks","download_url":"https://codeload.github.com/amicks/Huffman-Coding/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amicks%2FHuffman-Coding/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262879528,"owners_count":23378632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T09:11:30.012Z","updated_at":"2025-07-01T01:34:52.847Z","avatar_url":"https://github.com/amicks.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"###### Author: Allston Mickey\n\n## Files:\n* bv.h\n* code.h\n* decode.c\n* encode.c\n* heap.h\n* huffman.c, huffman.h\n* queue.c, queue.h\n* stack.c, stack.h\n* Makefile\n\n## How to compile \u0026 run:\nCommand | Description\n--- | ---\nmake | Compiles the encode and decode programs. \nmake all | Compiles the encode and decode programs. \nmake encode | Compiles the encode program.\nmake decode | Compiles the decode program.\nmake clean | Remove the object files and encode/decode binaries\n./encode _[flags]_ | Run the encode program.\n./decode _[flags]_ | Run the decode program.\n\n## Flags:\nArgument(s) | Description | Coding Type\n--- | --- | ---\n-i _[path]_ | Full path to the input file | Both **_[REQUIRED]_**\n-o _[path]_ | Full path to the output file | Both\n-A | Sets all flags (-vp, -ch if available) | Both\n-v | Enable verbose mode - prints statistics about the program | Both\n-p | Prints the Huffman Tree | Both\n-c | Prints the codes/bit paths to each leaf in the Huffman Tree | Encoding\n-h | (./encode only) Prints the histogram of bytes | Encoding\n\n## Description:\nThese programs encode/decode any file by using the greedy Huffman Algorithm.\n#### [encoding]\n1. Construct a histogram of the bytes in a file.\n2. Enqueue each histogram entry as a node in the Huffman Tree.\n3. Repeatedly dequeue 2X and enqueue until the root of the tree is remaining.\n4. Load the codes for each leaf by a post-order traversal of the tree, assigning a 0 when traversing left and a 1 when traversing right.  Store the codes in a bit vector for maximum efficiency.\n5. Write the tree and the paths to each leaf to an encoded output file.\n\n#### [decode]\n1. Read the encoded file.\n2. Reconstruct the Huffman Tree with a stack.\n3. For each byte in the original, uncompressed file, look up its code and step through the tree.\n4. Write the bytes back to a decoded output file.\n---\n* Using both programs, any file can be encoded and then decoded back to an exact copy of the original.\n* Note that the default permissions to a file are 0744 (-rwxr--r--).\n  You may change these on your own if they do not suit what you intended.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famicks%2Fhuffman-coding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famicks%2Fhuffman-coding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famicks%2Fhuffman-coding/lists"}