aboutsummaryrefslogtreecommitdiff
path: root/source/binarytree.py
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-03-23 21:05:20 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-03-23 21:05:20 +0100
commit538ad691be38618ae39bd5093b8608ea34f08684 (patch)
tree526adf2dae581222784548e1dbe307a113e2503f /source/binarytree.py
parentBugfix: wrong function call in the recursive tree walking function. (diff)
downloadnewspipe-538ad691be38618ae39bd5093b8608ea34f08684.tar.gz
newspipe-538ad691be38618ae39bd5093b8608ea34f08684.tar.bz2
newspipe-538ad691be38618ae39bd5093b8608ea34f08684.zip
Improvement to the binarytree implementation: the root is now given to the __init__ function.
Diffstat (limited to 'source/binarytree.py')
-rw-r--r--source/binarytree.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/binarytree.py b/source/binarytree.py
index 52e32db7..c9747d57 100644
--- a/source/binarytree.py
+++ b/source/binarytree.py
@@ -21,11 +21,11 @@ class OrderedBinaryTree(object):
"""
Represents a binary ordered .
"""
- def __init__(self):
+ def __init__(self, root):
"""
Initializes the root member.
"""
- self.root = None
+ self.root = root
def addNode(self, data):
"""
@@ -147,7 +147,8 @@ class OrderedBinaryTree(object):
"""
Pretty display.
"""
- return ", ".join([article["article_title"] for article in self.in_order_traversal(self.root)])
+ return ", ".join([article["article_title"] for article in \
+ self.in_order_traversal(self.root)])
if __name__ == "__main__":
# Point of entry in execution mode.
bgstack15