Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HUFFMAN ENCODING in C++ 2012
#1
Huffman encoding is a way to assign binary codes to symbols that reduces the overall number of bits used to encode a typical string of those symbols.
Huffman Code: Example

The following example bases on a data source using a set of five different symbols. The symbol's frequencies are:

Symbol Frequency
A 24
B 12
C 10
D 8
E 8
----> total 186 bit
(with 3 bit per code word)


The two rarest symbols 'E' and 'D' are connected first, followed by 'C' and 'D'. The new parent nodes have the frequency 16 and 22 respectively and are brought together in the next step. The resulting node and the remaining symbol 'A' are subordinated to the root node that is created in a final step.

Code Tree according to Huffman


Symbol Frequency Code Code total
Length Length
A 24 0 1 24
B 12 100 3 36
C 10 101 3 30
D 8 110 3 24
E 8 111 3 24
---------------------------------------
ges. 186 bit tot. 138 bit
(3 bit code)


0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  i take input from getchar(); function in program in C++ 2012 Vuhelper 0 2,995 05-31-2012, 01:40 AM
Last Post: Vuhelper
  what is meant by trivial and non trivial in C and C++ 2012 Vuhelper 0 4,057 05-31-2012, 01:38 AM
Last Post: Vuhelper
  how can i mail you the snapshot of compiled files.in C++ 2012 Vuhelper 0 2,871 05-31-2012, 01:32 AM
Last Post: Vuhelper
  protected inheritance and abstract classes in C++ 2012 Vuhelper 0 1,708 01-14-2012, 05:48 PM
Last Post: Vuhelper
  std::cout<<"---"; " and also for cin " std::cin>>x; in C++ 2012 Vuhelper 0 3,139 01-14-2012, 05:46 PM
Last Post: Vuhelper
  program Output in C++ 2012 Vuhelper 0 2,960 01-06-2012, 12:28 AM
Last Post: Vuhelper
  Threaded Binary Tree? in C++ 2012 Vuhelper 0 3,474 01-06-2012, 12:25 AM
Last Post: Vuhelper
  Explain the difference b/w Null Pointer and Null Nodes? C++ 2012 Vuhelper 0 1,951 01-06-2012, 12:24 AM
Last Post: Vuhelper
  What is the difference b/w Inorder Traversal and Inorder Successor? 2012 Vuhelper 0 1,788 01-06-2012, 12:23 AM
Last Post: Vuhelper
  What is mean by octet? how they are converted? in C++ 2012 Vuhelper 0 1,790 01-04-2012, 11:10 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)