Обновить u9/huffman_tree.py
This commit is contained in:
parent
caba5f1d5a
commit
119664fb08
@ -24,11 +24,11 @@ class HuffmanTree:
|
||||
|
||||
if not found:
|
||||
nodes.append(HuffmanNode(char,1))
|
||||
while len(nodes) > 1:
|
||||
first = 0
|
||||
second = 1
|
||||
if nodes[first].frequency > nodes[second].frequency:
|
||||
first, second = second, first
|
||||
while len(nodes) > 1:
|
||||
first = 0
|
||||
second = 1
|
||||
if nodes[first].frequency > nodes[second].frequency:
|
||||
first, second = second, first
|
||||
|
||||
for i in range(2, len(nodes)):
|
||||
if nodes[i].frequency < nodes[first].frequency:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user