How to coding Huffman Tree

3 views (last 30 days)
Yagmur Tabak
Yagmur Tabak on 10 Mar 2021
p = [0.10 0.20 0.10 0.25 0.35];
P = zeros(length(p)) ;
for i = 1: length (p)
for j = 1: length (p)
P (i, j) = p(i) * p(j);
end
p
end
for i=1:length(p)
entropy =-sum(p.* log2(p));
end
By writing a code like this, I obtained 25 super symbols and then calculated their probabilities.
then I calculated the entropy.
Now I have to create a huffman tree and find its mappings using the 25 super symbols I calculated.
I can do this with a simple for loop, but I can't get out of it.
can you help me?

Answers (0)

Categories

Find more on Large Files and Big Data in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!