How to coding Huffman Tree

조회 수: 3 (최근 30일)
Yagmur Tabak
Yagmur Tabak 2021년 3월 10일
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?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by