{"id":20856455,"url":"https://github.com/vishalkg/huffman_coding","last_synced_at":"2025-07-27T15:40:32.105Z","repository":{"id":250943531,"uuid":"83760849","full_name":"vishalkg/huffman_coding","owner":"vishalkg","description":null,"archived":false,"fork":false,"pushed_at":"2017-04-29T02:32:49.000Z","size":32708,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-19T07:12:17.527Z","etag":null,"topics":["binary-heap","cache-optimized-heap","data-structures-algorithms","encoder-decoder","huffman-coding","huffman-compression-algorithm","huffman-reader","huffman-tree","huffman-writer","java-8","pairing-heap"],"latest_commit_sha":null,"homepage":"","language":"Java","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/vishalkg.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-03-03T05:25:53.000Z","updated_at":"2017-04-06T05:23:00.000Z","dependencies_parsed_at":"2024-07-31T00:50:57.672Z","dependency_job_id":null,"html_url":"https://github.com/vishalkg/huffman_coding","commit_stats":null,"previous_names":["vishalkg/huffman_coding"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishalkg%2Fhuffman_coding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishalkg%2Fhuffman_coding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishalkg%2Fhuffman_coding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vishalkg%2Fhuffman_coding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vishalkg","download_url":"https://codeload.github.com/vishalkg/huffman_coding/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243230066,"owners_count":20257640,"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":["binary-heap","cache-optimized-heap","data-structures-algorithms","encoder-decoder","huffman-coding","huffman-compression-algorithm","huffman-reader","huffman-tree","huffman-writer","java-8","pairing-heap"],"created_at":"2024-11-18T04:31:49.036Z","updated_at":"2025-03-12T13:43:12.097Z","avatar_url":"https://github.com/vishalkg.png","language":"Java","readme":"# Huffman Coding\nGiven a frequency data, produces huffman codes for the unique messages.\n\n* Node.java: DS for storing huffman tree\n* PairNode.java: DS used in PairingHeap.java\n* BinaryHeap.java: To implement binary heap\n* PairingHeap.java: To implement pairing heap\n* D_aryHeap.java: To implement D-ary heap. For eg. 4-way heap.\n* Gen_huffman_code.java: To comapre the performance of above mentioned priority queues for huffman coding.\n\nUsage:\n```\n~:src$ java Gen_huffman_code ../sample_input_large.txt \nReading input file ... Building Freq Table ... Done.\nBuilding Huffman Tree using Binary Heap ... \nRun:1.. 2.. 3.. 4.. 5.. 6.. 7.. 8.. 9.. 10..  Done\nAverage Time: 1663.0\nBuilding Huffman Tree using Pairing Heap ... \nRun:1.. 2.. 3.. 4.. 5.. 6.. 7.. 8.. 9.. 10..  Done\nAverage Time: 3417.0\nBuilding Huffman Tree using 4-ary Heap ... \nRun:1.. 2.. 3.. 4.. 5.. 6.. 7.. 8.. 9.. 10..  Done\nAverage Time: 1291.0\n```\n\nIt is found that 4-ary heap is the fastest. So later encoding is done using 4-ary heap.\n\n* encoder.java: Produces code_table.txt containing codes for all the unique messages; and encoded.bin, which is the binary file for the codes corresponding to the input file.\n\nUsage:\n```\n~:src$ java encoder ../sample_input_large.txt \nReading input file ... \nBuilding Freq Table ... \nBuilding huffman tree... Done.\nGenerating code_table.txt .. Done.\nGenerating encoded.bin .. Done.\n```\n\nAs a proof of concept, we will reconstruct our input using code_table.txt and encoded.bin\n\n* decoder.java: Takes in input encoded.bin and code_table.txt and produces decoded.txt which is exactly the same as sample_input_large.txt as used in encoder.\n\nUsage:\n```\n~:src$ java decoder encoded.bin code_table.txt \nBuilding huffman tree from code_table.txt .. \nReading code_table.txt .. Done.\nReading encoded.bin .. Done.\nGenerating decoded.txt .. Done.\n```\n\nDo `diff decoded.txt ../sample_input_large.txt` to check correctness.\n\nClone repository and make:\n```\n~:$ git clone https://github.com/vishalkg/huffman_coding.git\n~:$ cd huffman_coding/src\n~:src$ make\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvishalkg%2Fhuffman_coding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvishalkg%2Fhuffman_coding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvishalkg%2Fhuffman_coding/lists"}