Huffman encoding

Creator
Creator
Seonglae Cho
Created
Created
2023 Nov 2 6:37
Editor
Edited
Edited
2025 Mar 19 11:55

Huffman coding (Variable length coding)

Some characters are more frequent than others and for them we can uses only one or two bits. Assign shorter codes to characters that occur more frequently.
notion image
 
 

Steps

  1. Calculate a frequency for each node
  1. Connect smallest numbers
    1. notion image
  1. Assign 0 to left branches, 1 to right branches
  1. Each encoding is a path from the root
    1. notion image
 
 
 
 
 
 
 

Recommendations