Upload files to 'huffman_py'
This commit is contained in:
parent
98aa221856
commit
e0d3ecf9a2
@ -50,12 +50,12 @@ class Tree(object):
|
||||
L = list()
|
||||
L.append(self.root)
|
||||
while len(L) > 0:
|
||||
traitement = L.pop(0)
|
||||
self.nodes.append(traitement)
|
||||
if traitement.left:
|
||||
L.append(traitement.left)
|
||||
if traitement.right:
|
||||
L.append(traitement.right)
|
||||
treatment = L.pop(0)
|
||||
self.nodes.append(treatment)
|
||||
if treatment.left:
|
||||
L.append(treatment.left)
|
||||
if treatment.right:
|
||||
L.append(treatment.right)
|
||||
|
||||
def set_id(self):
|
||||
# Give unique identifiers to every node in a tree
|
||||
@ -94,8 +94,8 @@ class Tree(object):
|
||||
|
||||
return self
|
||||
|
||||
def seek(self, node):
|
||||
def seek(self, node_to_seek):
|
||||
for node in self.nodes:
|
||||
if node == node:
|
||||
if node == node_to_seek:
|
||||
return node
|
||||
return None
|
||||
|
Loading…
x
Reference in New Issue
Block a user