Huffman Algorithm:
For a given sequence of letters.
Step 1:
Count the frequency of occurance for the letters in the sequence.
Step 2:
Sort the frequencies into increasing order.
Step 3:
Build the Huffman coding tree.
a) Choose the two smallest values, make a binary tree with these values.
b) Accumulate the sum of these values.
c) Replace the sum in place of original two smallest values and repeat from step 2.
Step 4:
Making the codes. Traverse tree in top down fashion
a) Assign 0 to the left branch and 1 to the right branch
b) Accumulate 0s and 1s for each character from root to end vertex
c) This is the Huffman code for that character.
Following image contains solution for problem 7.
Solution for problem 8 is as follows.
8. For your Huffman Tree above, let X- . number of bits required to encode letter x Make a table ...
You will construct a Huffman tree based on the given frequencies of 26 English alphabets in upper case plus the space character. An internal tree node class in HuffmanTree with necessary information is required. • You will not randomly switch left and right children when merger two trees. Instead, you will build a right-heavy tree according to the following strategies to select the right child. (1) The tree that is taller will be the right child, i.e., the height is...
For this assignment, you will write a program to work with Huffman encoding. Huffman code is an optimal prefix code, which means no code is the prefix of another code. Most of the code is included. You will need to extend the code to complete three additional methods. In particular, code to actually build the Huffman tree is provided. It uses a data file containing the frequency of occurrence of characters. You will write the following three methods in the...
It is thought that basketball teams that make too many fouls in a game tend to lose the game even if they otherwise play well. Let x be the number of fouls more than (i.e., over and above) the opposing team. Let y be the percentage of times the team with the larger number of fouls wins the game. x 1 2 5 6 y 48 42 33 26 Complete parts (a) through (e), given Σx = 14, Σy =...
Given the State Table Below 01 02 Q3 X-1 A. B. C. Draw a state Diagram (S points) Create the "design truth table" for the "next state" and the "output" (5 points) Make a Karnaugh for each "next state" and the "output" (10 points) When making the Karnaugh maps, "xQ1" should be along the top and "O203" along the side (The two missing states should be considered "DONT CARES") Write the "Next State" and Output equations from the Karnaugh maps...
QUESTION 3 [20M] Given the data below, where x is the number of hours playing online game, y is the student's class test marks Student Variable 10 20 12 40 80 60 50 a) Name the two most popular correlation coefficients. b) Which one will you use for the data presented in the above table and why? c) Calculate the correlation coefficient, r d) Make a scatter plot of the data. From the plot, does the word linear really provide...
Need help with number 3 the last one Need help with number 3 I have already given the whole question MATH 1030 – Application Assignment 3 Cryptography Due: Thursday, June 4, 2020 at 11:59pm Atlantic time (submit through Brightspace) You must show your work for full marks. The goal of this assignment is to use our knowledge of linear algebra to do cryptography. We will encrypt a plaintext using a cipher where the resulting ciphertext should not be legible unless...
A road's profile is given by the function 30 +22, for 0 sx 15, where x is the 40 25 horizontal distance in miles, and y is the elevation in feet above sea level. 20 15 10 2 4 6 8 10 12 14 FOR THE FOLLOWING PROBLEMS, USE AT LEAST 3 DECIMAL PLACES OF PRECISION FOR COMPUTATIONS, BUT REPORT FINAL ANSWERS TO 1 DECIMAL PLACE. a) Determine the average elevation of the road over the interval 0sx 515. Find...
One-Variable Data Table Your maximum weekly production capability is 200 gallons. You would like to create a one-variable data table to measure the impact of Production Cost, Gross Profit, and Net Profit based on selling between 10 and 200 gallons of paint within a week. a. Start in cell E3. Complete the series of substitution values ranging from 10 to 200 at increments of 10 gallons vertically down column E. b. Enter references to the Total Production Cost, Gross Profit,...
It is thought that basketball teams that make too many fouls in a game tend to lose the game even if they otherwise play well. Let x be the number of fouls more than (i.e., over and above) the opposing team. Let y be the percentage of times the team with the larger number of fouls wins the game. х 33 26 y48 44 14, Ey 151, x2 = 66, Ey2 = 6005, Exy Complete parts (a) through (e), given...
Student #2 C- 72% 144 34 0 40 70 Student #3 74% C 148 40 10 43 55 Student # 4 50 36 A 93% 186 10 90 Student #5 B+ 87% 174 48 10 46 70 Student #6 56% 112 44 5 28 35 Student #7 65 84% 168 50 10 43 Student #8 48 B- 80% 159 46 10 55 Student #9 C+ 79% 158 50 10 73 25 Student #10 86% 172 33 5 44 90 Student...