Prepares binary search tree data structure.

This commit is contained in:
2013-07-07 11:22:18 +02:00
parent 40f77e4ea5
commit 6cf5ce85d8
2 changed files with 34 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
"""
Binary Search Tree Implementation
@jlengrand
2013/07
"""
class BinarySearchTree():
"""
Defines a complete binary search Tree.
A binary search tree has a root node.
We also add a size to the search tree, that corresponds to the number of
nodes it has.
"""
def __init__(self):
self.size = 0
self.root_node = None
class BinarySearchNode():
"""
Defines any node of the Binary Search Tree.
A node has at most 2 children, and it has a value.
It also must have a parent
"""
def __init__(self, value, parent):
self.parent_node = parent
self.node_value = value
self.left_child = None
self.right_child = None

View File

@@ -0,0 +1,5 @@
"""
Unit tests for the binary search tree data structure
@jlengrand
2013/07
"""