本文整理汇总了Python中bintrees.FastRBTree.from_keys方法的典型用法代码示例。如果您正苦于以下问题:Python FastRBTree.from_keys方法的具体用法?Python FastRBTree.from_keys怎么用?Python FastRBTree.from_keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bintrees.FastRBTree
的用法示例。
在下文中一共展示了FastRBTree.from_keys方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: open
# 需要导入模块: from bintrees import FastRBTree [as 别名]
# 或者: from bintrees.FastRBTree import from_keys [as 别名]
"""
setup_FastRBTree_ps = """
from __main__ import keys, crb_prev, crb_succ
"""
try:
fp = open('testkeys.txt')
keys = eval(fp.read())
fp.close()
bskeys = zip(keys, keys)
except IOError:
print("create 'testkeys.txt' with profile_bintree.py\n")
sys.exit()
ptree = PTree.from_keys(keys)
ftree = FTree.from_keys(keys)
def rb_prev():
for key in keys:
try:
item = ptree.prev_item(key)
except KeyError:
pass
def rb_succ():
for key in keys:
try:
item = ptree.succ_item(key)
except KeyError:
示例2: crb_build
# 需要导入模块: from bintrees import FastRBTree [as 别名]
# 或者: from bintrees.FastRBTree import from_keys [as 别名]
def crb_build():
tree = FastRBTree.from_keys(keys)
示例3: range
# 需要导入模块: from bintrees import FastRBTree [as 别名]
# 或者: from bintrees.FastRBTree import from_keys [as 别名]
COUNT = 1
ITEMS = 2**22
setup_dict = """
from __main__ import dict_build_delete, dict_build, dict_search
"""
setup_FastRBTree = """
from __main__ import crb_build_delete, crb_build, crb_search
"""
keys = [k for k in range(ITEMS)]
shuffle(keys)
fastrbtree_searchtree = FastRBTree.from_keys(keys)
dict_searchtree = dict.fromkeys(keys)
def dict_build_delete():
d = dict.fromkeys(keys)
for key in keys:
del d[key]
def crb_build_delete():
tree = FastRBTree.from_keys(keys)
for key in keys:
del tree[key]
示例4: crb_build_delete
# 需要导入模块: from bintrees import FastRBTree [as 别名]
# 或者: from bintrees.FastRBTree import from_keys [as 别名]
def crb_build_delete():
tree = FastRBTree.from_keys(keys)
for key in keys:
del tree[key]
示例5: open
# 需要导入模块: from bintrees import FastRBTree [as 别名]
# 或者: from bintrees.FastRBTree import from_keys [as 别名]
"""
setup_FastRBTree = """
from __main__ import crb_build_delete, crb_build, crb_search
"""
try:
fp = open('testkeys.txt')
keys = eval(fp.read())
fp.close()
bskeys = zip(keys, keys)
except IOError:
print("create 'testkeys.txt' with profile_bintree.py\n")
sys.exit()
py_searchtree = RBTree.from_keys(keys)
cy_searchtree = FastRBTree.from_keys(keys)
def rb_build_delete():
tree = RBTree.from_keys(keys)
for key in keys:
del tree[key]
def crb_build_delete():
tree = FastRBTree.from_keys(keys)
for key in keys:
del tree[key]
def rb_build():