def test_set(): bst.set([10, 'hello']) bprint(repr(bst)) bst.set([3, 'change val']) bprint(repr(bst)) bst.set([-1, 'anyone']) bprint(repr(bst)) bst.set([6, 'home']) bprint(repr(bst))
def test_setitem(): btree[1] = [11, 'DD'] bprint(repr(btree)) btree[4] = [44, 'haha'] bprint(repr(btree)) btree[9] = [99, 'hello'] bprint(repr(btree)) btree[7] = None bprint(repr(btree))
def test_delitem(): bprint(repr(btree)) del btree[5] bprint(repr(btree)) del btree[2] bprint(repr(btree)) del btree[4] del btree[7] del btree[2] # del btree[1] bprint(repr(btree))
def test_remove(): bst.remove(1) bprint(repr(bst)) bst.remove(6) bprint(repr(bst)) bst.remove(5) bprint(repr(bst))
def test_find(): bprint(repr(btree.find(11))) bprint(repr(btree.find(1))) bprint(repr(btree.find(3)))
def test_getitem(): bprint(repr(btree[1])) bprint(repr(btree[2])) bprint(repr(btree[5])) bprint(repr(btree[6])) bprint(repr(btree[7])) bprint(repr(btree[20]))
def test_init(): bprint(btree) bprint(repr(btree)) bprint("btree size:", len(btree))
def test_min(): bprint(repr(bst)) bprint(repr(bst.find_min())) bst.pop_min() bprint(repr(bst))
def test_find(): bprint(repr(bst.find(3))) bprint(repr(bst.find(8))) bprint(repr(bst.find(7))) bprint(repr(bst.find(11)))