當前位置: 首頁>>代碼示例>>Python>>正文


Python BTree.set_bnode_minimum_degree方法代碼示例

本文整理匯總了Python中durus.btree.BTree.set_bnode_minimum_degree方法的典型用法代碼示例。如果您正苦於以下問題:Python BTree.set_bnode_minimum_degree方法的具體用法?Python BTree.set_bnode_minimum_degree怎麽用?Python BTree.set_bnode_minimum_degree使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在durus.btree.BTree的用法示例。


在下文中一共展示了BTree.set_bnode_minimum_degree方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: insert_item

# 需要導入模塊: from durus.btree import BTree [as 別名]
# 或者: from durus.btree.BTree import set_bnode_minimum_degree [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()
開發者ID:Schevo,項目名稱:durus,代碼行數:27,代碼來源:utest_btree.py


注:本文中的durus.btree.BTree.set_bnode_minimum_degree方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。