Обновить u9/huffman_tree.py
This commit is contained in:
parent
14a6744fd0
commit
caba5f1d5a
@ -37,15 +37,15 @@ class HuffmanTree:
|
|||||||
elif nodes[i].frequency < nodes[second].frequency:
|
elif nodes[i].frequency < nodes[second].frequency:
|
||||||
second = i
|
second = i
|
||||||
|
|
||||||
left = nodes[first]
|
left = nodes[first]
|
||||||
right = nodes[second]
|
right = nodes[second]
|
||||||
|
|
||||||
new_node = HuffmanNode(
|
new_node = HuffmanNode(
|
||||||
None,
|
None,
|
||||||
left.frequency + right.frequency,
|
left.frequency + right.frequency,
|
||||||
left,
|
left,
|
||||||
right
|
right
|
||||||
)
|
)
|
||||||
|
|
||||||
nodes.remove(left)
|
nodes.remove(left)
|
||||||
nodes.remove(right)
|
nodes.remove(right)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user