예제 #1
0
def test__BST_is_bst_satisified5():
    bst = BST()
    bst.root = Node(0)
    bst.root.left = Node(-2)
    bst.root.left.left = Node(-3)
    bst.root.left.right = Node(-1)
    bst.root.right = Node(2)
    bst.root.right.left = Node(1)
    bst.root.right.right = Node(3)
    assert bst.is_bst_satisfied()
예제 #2
0
def test__BST_is_bst_satisified4():
    bst = BST()
    bst.root = Node(0)
    bst.root.left = Node(-1)
    assert bst.is_bst_satisfied()
예제 #3
0
def test__BST_is_bst_satisfied2():
    bst = BST()
    bst.root = Node(-2)
    bst.root.left = Node(-3)
    bst.root.right = Node(-4)
    assert not bst.is_bst_satisfied()