class Node:
def __init__(self,value = None):
self.value = value
self.left = None
self.right = None
class binary_search_tree:
def __init__(self):
self.root = None
def insert(self,current,value):
if current == None:
current = Node(value)
elif value < current.value:
self.insert(current.left,value)
elif value > current.value:
self.insert(current.right,value)
tree = binary_search_tree()
for i in (12,5,18,3,4,6):
tree.insert(tree.root,i)
我的二分查找树的插入方法不起作用,有人可以帮助我。
(帖子主要是代码,请添加更多详细信息。)