From 119664fb082d644f6193703eaabb14554989f5ba Mon Sep 17 00:00:00 2001 From: Arina Dohadailo Date: Thu, 12 Nov 2026 22:51:16 +0000 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20u9/huffman=5Ftree.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- u9/huffman_tree.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/u9/huffman_tree.py b/u9/huffman_tree.py index 6884d4b..0c0df43 100644 --- a/u9/huffman_tree.py +++ b/u9/huffman_tree.py @@ -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: