Program to create huffman codes

Assignment Help Data Structure & Algorithms
Reference no: EM13164975

Write a C++ program to create Huffman codes. Program input is a file called freq.txt (make up your own file for testing) that contains data on the characters in some cleartext file in the form of each character's non-zero frequency of occurrence in the cleartextfile. (Note that these are frequency counts, not percentages, and it doesn't matter if the values do not sum to 100.) You can assume that freq.txt contains only characters from the standard ASCII 128 character set and that the results are ordered by the ASCII integer for each character. The end-of-line character in a text file is a non-printable line feed character, with ASCII code 10, and will be written in the freq.txtfile as LF. Thus the freq.txt file might look like

LF 2

c 3

d 5

e 14

f 2

Your program should create a "code table" that gives each character and its binary Huffman code. Save this information in an external file called codetable.txt where each line of the file is a character and its code, ordered by the ASCII value of the character.

Reference no: EM13164975

Questions Cloud

What are the frequency and energy of a photon : What are the frequency and energy of a photon with a wavelength of 900 nm. Report your answers to three significant digits.
What are the masses and precent abundances of each : boron has two naturally occuring isotopes,, 10B (19.9%) and 11B(80.1. althought the b2 molecule doesn not exist naturally on earth, it been been produced in the laboratory and been observed in stars..
Overland flow paths from animal feedlots to nearest drainage : we are trying to determine the overland flow paths from animal feedlots to the nearest drainage. using a "least cost path" tool in GIS works about half the time (sometimes the flow path does not reach a drainage, other times it reaches the drainages ..
State the burning of sufficient magnesium in oxygen : The burning of sufficient magnesium in oxygen to form 2.00 grams of magnesium oxide results in the liberation of 30.1 kj.
Program to create huffman codes : Write a C++ program to create Huffman codes. Program input is a file called freq.txt (make up your own file for testing) that contains data on the characters in some cleartext file in the form of each character's non-zero frequency of occurrence i..
What is the new pressure in the bicycle tire : A bicycle tire is filled with air to a pressure of 75. psi at a temperature of 19 degrees celcius. Riding the bike on asphalt on a hot day increases the temperature of the tire to 58 degrees celcius. The volume of the tire increases by 4.0%. What ..
Compute the ph of the buffer after the addition : Calculate the pH of the buffer after the addition of 1.5 g of HCl (36.5 g/mol). (Ka of HNO2 = 7.1x10^-4.)
Compute the net realizable value at the end of 2011 : Compute the net realizable value at the end of 20X1 and 20X2 as a percentage of respective year-end receivables balances. Analyze your findings and comment on the president s decision to close the credit evaluation department.
Matlab that will use the flipping of two-sided coins to sim : Write a program in matlab that will use the flipping of two-sided coins to simulate any event that has a probability of success(Ps) that ranges between 0 and 1. The simulation will most likely be approximate. It must be accurate to at least 0.01

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd