This commit is contained in:
Marege 2026-11-10 18:49:16 +01:00
parent e6e8058fac
commit 368e765897

View File

@ -53,13 +53,12 @@ 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 {}
else:
if self.root.left is None and self.root.right is None:
return {self.root.data: "0"}
walk(self.root, "", codik)
return codik