Professional Documents
Culture Documents
symbols a b c d e f l
frequencies 2 4 6 8 10 12 16
symbols a b c d e f l
frequencies 2 4 6 8 10 12 16
Step2:- taking first two elements from the queue and add them
n1(6)
a(2) b(4)
n2(12)
c(6) n1(6)
a(2) b(4)
taking d ,e from the queue
n4(18)
a(2) b(4)
taking f and n2
n3(24)
f(12) n2(12)
c(6) n1(6)
c(6) n1(6)
a(2) b(4)
adding l, n4
n5(34)
l(16) n4(18)
queue becomes:-
n3(24) n5(34)
a(2) b(4)
n6(58)
0 1
n3(24) n5(34)
0 1 0 1
f(12) n2(12) l(16) n4(18)
0 1 0 1
c(6) n1(6) d(8) e(10)
0 1
a(2) b(4)
now the codes are
symbols a b c d e f l
frequencies 2 4 6 8 10 12 16
codes 0110 0111 010 110 111 00 10
B
A
F
D C