Question

In: Computer Science

Programming: Use the generic Huffman_Tree<T> on Blackboard to encode the words in your favorite nursery rhyme.


Programming: Use the generic Huffman_Tree<T> on Blackboard to encode the words in your favorite nursery rhyme. 

Solutions

Expert Solution

Let us take the word 'assessment', First we need to write the frequency of each letter in the word:

Letter Freq.
a 1
s 4
e 2
m 1
n 1
t 1

To construct a tree, we merge the two letters with least frequency and repeat the process untill we get the single element, the tree generated is:

Huffman code for words are:

Letter Code
a 100
s 0
e 110
m 101
n 1110
t 1111

Encoded word: 100001100010111011101111


Related Solutions

. Input the Restaurant menu problem into your generic linear programming spreadsheet and confirm the solution...
. Input the Restaurant menu problem into your generic linear programming spreadsheet and confirm the solution given (or prove it wrong). How Do Restaurants Use Linear Programming for Menu Planning? Linear algebra helps restaurants earn a profit. Restaurants use linear programming for menu planning. It uses basic algebra to optimize meal production and thereby increase restaurant profits. Linear algebra reflects a direct relationship between an increase or decrease in food resources, and an increase or decrease in meal production. For...
Both the SSTS and Circular 230 have been posted on Blackboard for your use in answering...
Both the SSTS and Circular 230 have been posted on Blackboard for your use in answering the following questions. Answer the following questions using the SSTS’s or Circular 230.   For each question cite the Standard or page number and section number of Circular 230 for which your answer is based upon. (Member means tax preparer.) (Disregard the page number) ______ 21.    A member may omit answering a question on a tax return if reasonable grounds exist for omitting the answer...
Implement the MSI cache coherence protocol in your favorite programming language (C, C++, Java, python, etc.)....
Implement the MSI cache coherence protocol in your favorite programming language (C, C++, Java, python, etc.). Wikipedia has a nice high level description of the protocol. Consider only one level of cache which is a write back cache. Moreover, assume that there are 4 processing cores working on a single shared memory. To simplify, assume that you are writing the code for only one block of cache and that block can hold 4 different memory locations.
Instructions Use your solution from Programming Assignment 5 (or use your instructor's solution) to create a...
Instructions Use your solution from Programming Assignment 5 (or use your instructor's solution) to create a modular Python application. Include a main function (and a top-level scope check),and at least one other non-trivial function (e.g., a function that deals the new card out of the deck). The main function should contain the loop which checks if the user wants to continue. Include a shebang, and ID header, descriptive comments, and use constants where appropriate. Sample Output (user input in red):...
2a) Explain in your own words what Ansoff’s generic strategy model (shown below) is useful for....
2a) Explain in your own words what Ansoff’s generic strategy model (shown below) is useful for. [5 marks]
Drug Class Exemplar Generic (Brand) Mechanism of Action (in your own words) Common and Major Side...
Drug Class Exemplar Generic (Brand) Mechanism of Action (in your own words) Common and Major Side Effects Nursing Actions/ Considerations Desired Outcomes PME 4.0 GI: Drugs for Nausea Serotonin Antagonist Ondansetron (Zofran) Dopamine Antagonist/ Prokinetic agent Metoclopromide (Reglan) Anti-Emetic Prochlorperazine (Compazine, Compro) PME 4.0 Infection: Anti-fungals Polyene Antibiotics Nystatin (Mycostatin) Azoles Miconazole (Monistat) PME 4.0 Infection: Anti-virals Purine Analog Acyclovir (Zovirax) headache and nausea.
Research and explain in your words what is known as Object Oriented Programming. Then, identify two...
Research and explain in your words what is known as Object Oriented Programming. Then, identify two advantages of OOP for application development. In peer replies, choose from one of the following and define the concept as part of your response. Abstraction. Encapsulation. Inheritance. Polymorphism.
Use your favorite text editor or IDE to search for occurrences of setState. Where you found...
Use your favorite text editor or IDE to search for occurrences of setState. Where you found uses of setState, refactor the code to use JavaScript functions instead of classes and the useState hook instead of setState. import React from 'react' import ColorSlider from './ColorSlider' import ColorOutput from './ColorOutput' import styles from './ColorBrowser.module.css' class ColorBrowser extends React.Component { constructor(props) { super(props) this.state = { red: Math.floor(Math.random() * 256), green: Math.floor(Math.random() * 256), blue: Math.floor(Math.random() * 256) } } updateColor(e) { this.setState({...
Please use this information for the next 3 questions. At your favorite bond store, Easy Bonds,...
Please use this information for the next 3 questions. At your favorite bond store, Easy Bonds, you see the following prices: One year zero selling for $90.09 Three year 10% coupon $1,000 par bond selling for $1,000 Two year 10.5% coupon $1,000 par bond selling for $1,000 Assume that the expectations theory of interest rates holds, no liquidity premium exists and that the bonds are equally risky and liquid. What is the current one year rate? What is the implied...
a. In your own words, explain what is meant by good programming practice. Give two examples,...
a. In your own words, explain what is meant by good programming practice. Give two examples, one with good programming practice and one without good programming practice Note:java Programming Language
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT