Create huffman codes

Assignment Help C/C++ Programming
Reference no: EM13163666

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: EM13163666

Questions Cloud

Automated emails from google apps spreadsheet ? : How to send automated emails from google apps spreadsheet ?
Investigate the weaknesses that arise in elgamal encryption : investigate the weaknesses that arise in Elgamal encryption if a public key of small order is used. We look at the following example. Assume Bob uses the group Z
Dangerousmonster which inherits the monster : An interface - DangerousMonster which inherits the Monster interface and has a method called destroy() with void return type.(Note: Just like a class can inherit from another class, an interface can inherit from another interface using the "extends..
Create a website that would allow users to enter and submit : Create a Website that would allow users to enter and submit survey
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..
Discuss the issues that managing and implementing : Discuss the issues that managing and implementing the technology architecture you would have and how you would overcome these challenges. Be sure to discuss at least three challenges.
Give a recursive definition of s. : Let S be the set of positive integers that can be written as a sum of one or more 4's and/or 7's. For example, 7 ? S and 18 ? S (because 18 = 4 + 7 + 7)
Define three types of programming errors : Define three types of programming errors and explain with examples
Create a set of instructions : Provide a private address to be used for the AS and a public address to be used to connect to an ISP router connected to a border router.Create a set of instructions for the lab that would have students create a basic configuration and test connecti..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Function declare that it can throw an ioexception

Every C++ function that performs file I/O will thus need to either declare that it can throw an IOException, or contain a try-catch-finally block to deal with it. Response?

  Design for storing the maze layout

Design and implement a C++ program for maze layout

  Pros and cons of choosing two servers

Classify the two alternatives in terms of what type of application architecture they use. b. Outline the pros and cons of the two alternatives and make a recommendation to Fred about which is better.

  Create a text file named grades.txt

Write a program to calculate students' average test scores and their grades. Creat a text file named  grades.txt

  Write program to input series of hourly temperatures

Create and write a c++ program which inputs series of 24 hourly temperatures from file, and outputs bar chart (using stars) of temperatures for the day.

  Program to output value of tenth component of array

Write a C++ statements to perform the following: Set value of fourth component of array alpha to three times  value of eight component minus 57.

  Build a traffic light system - microcontroller system

Build the whole system with 3 RAG units and three puffin crossing units and build a team to work on this mini-project, be careful in selecting your team member.

  Main function to input twenty integers in given range

Write a main function to input 20 integers in range of 1-6, function should count number of times the numbers 2 and 5 occur. function must declare statics variables count2 and count5.

  C program to compute parking fare for customers

Write C program to compute parking fare for customers who park their cars in parking lot when following information is provided: A character showing type of vehicle: C for car, B for bus and T for truck

  Write program which inputs number of winning coupons

Write a program which inputs number of coupons you win and outputs how many candy bars and gumballs you can get if you spend all off your coupons on candy bars first and remaining coupons on gumballs in c++.

  File system with login authentication

Implement a simple file system with login authentication and access control - Construct a hash/salt/shadow based user/password creation system.

  The two-dimensional array

1. Given the two-dimensional array declared by the following statement int myArray[4][3] = {{2,4,6},{1,8,10},{3,5,7},[9,11,13}}; what is the value of myArray[1][2]

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