ANSWER :
Worst case will happen when f(a) > 2*f(b) ; f(b) > 2*f(c) ; f(c) > 2*f(d) ; f(d) > 2*f(e) and f(e) > 2*f(f).
Where f(x) is frequency of character x.
Lets consider the scenario when
f(a) = 0.555, f(b) = 0.25, f(c) = 0.12, f(d) = 0.05, f(e) = 0.02 and f(f) = 0.005
Below image shows the steps of construction of Huffman tree:-
From the Huffman tree created, we can see that endcoding e() of each character are as follows:-
e(a) = 0
e(b) = 10
e(c) = 110
e(d) = 1110
e(e) = 11110
e(f) = 11111
So we can see that maximum length of encoding is 5 in this case.
PLease comment for any clarification.
2. (10 points) Suppose we want to compress a text consisting of 6 characters, a, b,...
. Huffman Encoding (a.) (6 points) Suppose a certain file contains only the following letters with the corresponding frequencies 1 AİB 73 9 30 44 130 28 16 In a fixed-length encoding scheme, cach character is given a binary representation with the same number of bits. What is the minimum number of bits required to represent each letter of this file under fixed-length encoding scheme? Describe how to encode all seven letters in this file using the number of bits...
Recursion and Trees Application – Building a Word Index Make sure you have read and understood · lesson modules week 10 and 11 · chapters 9 and 10 of our text · module - Lab Homework Requirements before submitting this assignment. Hand in only one program, please. Background: In many applications, the composition of a collection of data items changes over time. Not only are new data items added and existing ones removed, but data items may be duplicated. A list data structure...
the pseudocode or precise description in words of the algorithm Problem 6. (20 points) Texting. You are competing with your friends to type text messages on your smartphone as quickly as possible. Here are the rules: you use two thumbs for texting and they start out on the bottom left and bottom right keys of the keyboard. To type a character, you move either thumb from its current key to the key you need to press, and it takes time...
This is for C++ Write a program that reads in a sequence of characters entered by the user and terminated by a period ('.'). Your program should allow the user to enter multiple lines of input by pressing the enter key at the end of each line. The program should print out a frequency table, sorted in decreasing order by number of occurences, listing each letter that ocurred along with the number of times it occured. All non-alphabetic characters must...
3. (25 pts) Consider the data points: t y 0 1.20 1 1.16 2 2.34 3 6.08 ake a least squares fitting of these data using the model yü)- Be + Be-. Suppose we want to m (a) Explain how you would compute the parameters β | 1 . Namely, if β is the least squares solution of the system Χβ y, what are the matrix X and the right-hand side vector y? what quantity does such β minimize? (b)...
SCREENSHOTS OF CODE ONLY!! PLEASE DON'T POST TEXT!! C++ CODE! PLEASE DON'T REPOST OLD POSTS! Objective To gain experience with the operations involving binary search trees. This data structure as linked list uses dynamic memory allocation to grow as the size of the data set grows. Unlike linked lists, a binary search tree is very fast to insert, delete and search. Project Description When an author produce an index for his or her book, the first step in this process...
CAN SOMEONE HELP WITH THIS? Part 1: power() method We want to write a method that will enable us to calculate a number to a given power. In other words, we are writing a method to mimic what the Math.pow() method we have seen before does. To write this method use the following requirements: The method should return an integer. It should have two parameters x and y both integers. The name of this method will be power(). For the...
1) Echo the input: First, you should make sure you can write a program and have it compile and run, take input and give output. So to start you should just echo the input. This means you should prompt the user for the plaintext, read it in and then print it back out, with a message such as "this is the plaintext you entered:". [4 points, for writing a working program, echoing the input and submitting the program on the...
Multivariable need help and some word explanation Iam a little bit confused on how to set up hy 2 dr xplain why the answers to parts (a) and (b) give the formula we want. e Distance Walked to an Airport Gate orts up in a terminal like points along a line. If you arriv , departure gates are often lined ate and proceed to another gate for a connecting flight, what propor inal will you have to walk, on average?...
For this assignment, suppose that a fence is recording entry and exit into the park via a string as the gate swings open and folks walk in or out with their pet. For example, C++ DP+dp+CP+cp would indicate that an adult dog and an adult entered the park, then a puppy and child entered the park, then an adult cat and an adult entered the park and finally a kitten and a child entered the park. From this information, note...