Пример #1
0
 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))
Пример #2
0
 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))
Пример #3
0
 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))
Пример #4
0
 def test_remove():
     bst.remove(1)
     bprint(repr(bst))
     bst.remove(6)
     bprint(repr(bst))
     bst.remove(5)
     bprint(repr(bst))
Пример #5
0
 def test_find():
     bprint(repr(btree.find(11)))
     bprint(repr(btree.find(1)))
     bprint(repr(btree.find(3)))
Пример #6
0
 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]))
Пример #7
0
 def test_init():
     bprint(btree)
     bprint(repr(btree))
     bprint("btree size:", len(btree))
Пример #8
0
 def test_min():
     bprint(repr(bst))
     bprint(repr(bst.find_min()))
     bst.pop_min()
     bprint(repr(bst))
Пример #9
0
 def test_find():
     bprint(repr(bst.find(3)))
     bprint(repr(bst.find(8)))
     bprint(repr(bst.find(7)))
     bprint(repr(bst.find(11)))