answersLogoWhite

0


Best Answer

Algorithm Huffman(X):

Input: String X of length n with d distinct characters

Output: Coding tree for X

Compute the frequency f(c) of each character c of X

Initialize a priority queue Q

for each character c in X do

Create a single-node binary tree T storing c

Insert T into Q with key f(c)

while Q.size() >= 1 do

f1 <- Q.min().key()

T1 <- Q.removein()

f2 <- Q.min().key()

T2 <- Q.removeMin()

Create a new binary tree T with left subtree T1 and right subtree T2

Isert T into Q with f1 + f2

return tree Q.removeMin()

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Develope a Huffman code for the input string a fast runner need never be afraid of the dark?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Why do the people of Umuofia call a snake a string and not a snake at night?

They do not call a snake by name because they are afraid it will hear it's name and respond.


How do you close a string literal?

Just as you have started it. good examples: 'string' "string" `string` &raquo;string&laquo; bad examples: 'string" "string` &raquo;string'


What is a collective noun for string?

The collective noun for 'string' is a ball of string.The noun 'string' is a standard collective noun for:a string of ducksa string of horsesa string of mulesa string of pearlsa string of poniesa string of racehorsesa string of violinists


What are a group of pearls called?

it's a String of Pearls


What is the a-string on a guitar?

The A string is the second string and the second thickest string.


What are the notes to rolling along on the violin?

f on the d string, e on the d string, d on the d string, e on the d string, f on the d string x3, e on the d string x3, f on the d string, a on the a string x2, f on the d string, e on the d string, d on the d string, e on the d string, f on the d string x3, e on the d string x2, f on the d string, e on the d string, d on the d string!! there you go!


The highest string in the cello is the what string?

A string


What are the competitions in The Kite Runner?

In &quot;The Kite Runner,&quot; the main competition is the kite-fighting tournament that takes place in Kabul. Participants fly kites and try to cut down each other's kites using a glass-coated string. The story revolves around the relationship between two friends, Amir and Hassan, and how their bond is tested during the kite-fighting competition.


Why is g string underwear called a g string?

G string may be a gusset string or the string of the thong may be as thin as a g string from the guitar


What is flies on string?

Flies on string is flies on string


Which lacrosse string is the top string?

the shooting string


What is the lowest string on a double bass?

The lowest string on a four string double bass is an E string. If you have a fairly rare five string double bass then the lowest fifth string is a B string.