Upload files to 'huffman_py'

This commit is contained in:
sam.hadow 2023-05-25 02:48:36 +02:00
parent 98aa221856
commit e0d3ecf9a2

View File

@ -50,12 +50,12 @@ class Tree(object):
L = list() L = list()
L.append(self.root) L.append(self.root)
while len(L) > 0: while len(L) > 0:
traitement = L.pop(0) treatment = L.pop(0)
self.nodes.append(traitement) self.nodes.append(treatment)
if traitement.left: if treatment.left:
L.append(traitement.left) L.append(treatment.left)
if traitement.right: if treatment.right:
L.append(traitement.right) L.append(treatment.right)
def set_id(self): def set_id(self):
# Give unique identifiers to every node in a tree # Give unique identifiers to every node in a tree
@ -94,8 +94,8 @@ class Tree(object):
return self return self
def seek(self, node): def seek(self, node_to_seek):
for node in self.nodes: for node in self.nodes:
if node == node: if node == node_to_seek:
return node return node
return None return None