本文整理汇总了Python中durus.btree.BTree.get_node_count方法的典型用法代码示例。如果您正苦于以下问题:Python BTree.get_node_count方法的具体用法?Python BTree.get_node_count怎么用?Python BTree.get_node_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类durus.btree.BTree
的用法示例。
在下文中一共展示了BTree.get_node_count方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: insert_item
# 需要导入模块: from durus.btree import BTree [as 别名]
# 或者: from durus.btree.BTree import get_node_count [as 别名]
def insert_item(self):
# This sequences leads to a splitting where
# the inserted item has the same key as the split
# point.
keys = [3, 56, 11, 57, 1, 32, 106, 98, 103, 108,
101, 104, 7, 94, 105, 85, 99, 89, 28, 65,
107, 95, 97, 93, 96, 102, 86, 100, 0, 14,
35, 15, 12, 6, 84, 90, 2, 81, 4, 5,
69, 9, 30, 78, 13, 10, 8, 82, 47, 62,
27, 88, 87, 83, 31, 79, 45, 91, 29, 92,
34, 33, 44, 25, 50, 26, 16, 17, 19, 43,
21, 64, 24, 37, 22, 59, 63, 18, 20, 38,
52, 55, 53, 42, 23, 39, 60, 40, 36, 41,
46, 61, 77, 75, 68, 74, 73, 71, 72, 70,
80, 54, 67, 66, 51, 49, 76, 58, 49]
bt = BTree()
for i, key in enumerate(keys):
bt[key] = i
assert bt[key] is i, (i, key, bt[key])
# Test set_bnode_minimum_degree()
assert bt.get_depth() == 2, bt.get_depth()
assert bt.get_node_count() == 7, bt.get_node_count()
assert bt.set_bnode_minimum_degree(4) == True
assert bt.get_depth() == 3, bt.get_depth()
assert bt.get_node_count() == 34, bt.get_node_count()