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

  Database design activities

Assume Ray wishes to start a DVD rental program at his stores that he plans to call Henry's DVD Club. He refers to each of his consumers as members.

  Create the entity relationship diagram

Create the entity relationship diagram for your project database based on the initial data requirements.

  Write algorithm to calculate the median using queries

Calculate the median using as few queries as possible. Provide an algorithm which determines the median value using at most O(lg n) queries.

  Algorithm to keep track of sufficient information

Your algorithm must keep track of sufficient information so that, for any computer Cb it is possible to retrieve in O(n) time a sequence of communications by which Cb could have become infected.

  C program to compute and display sales of a store

Modify the C program so that user inputs the buying amount. Check the user's input for validity.

  Steps of asymmetric encryption algorithms to read message

Using only asymmetric encryption algorithms write down any steps taken by Bob which permit him to read the message.

  Documentation and proper design procedures

Determine the main reason that make many developers skip over the documentation and proper design process? As a manager, discuss how do you ensure that the proper database design process are followed by database development teams?

  Using java, design and implement an api euclidean graph

Using Java, design and implement an API EuclideanGraph for graphs whose vertices are points in the plane that include coordinates.

  Er modeling

A supplier supplies certain number parts for a assignment, a assignment uses the parts from the different suppliers, and the same kind parts from different suppliers are used by different assignments.

  Writing algorithm which ?nds xbest

Provide an O(n) algorithm which ?nds xbest such that distbest:= ∑i=1 to n|xbest - xi| is as small as possible.

  Inventory tracking database

Construct a relational database of your choice. The DB should contain no more than six tables. Define three business requirements that this database will provide.

  Creating uml collaboration diagrams

Create UML collaboration diagrams using Microsoft Visio or another making tool capable of creating properly formatted UML collaboration diagrams.

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