From e6e8058facc92590e031c22ce26ffca2719e2c75 Mon Sep 17 00:00:00 2001 From: Marege Date: Tue, 10 Nov 2026 18:43:27 +0100 Subject: [PATCH] U9fix9 --- u9/huffman_tree.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/u9/huffman_tree.py b/u9/huffman_tree.py index 9686aca..b5146b4 100644 --- a/u9/huffman_tree.py +++ b/u9/huffman_tree.py @@ -53,6 +53,9 @@ class HuffmanTree: return self.root def codes(self): + if self.root.left is None and self.root.right is None: + return {self.root.data: "0"} + codik = {} if self.root is None: return {}