How to coding Huffman Tree
조회 수: 3 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File 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!