def main():
fp = open('testkeys.txt', 'w')
fp.write(repr(keys))
fp.close()
print ("Nodes: %d" % len(keys))
t = Timer("avl_build()", setup_AVLTree)
print_result(t.timeit(COUNT), 'AVLTree build only')
t = Timer("cavl_build()", setup_FastAVLTree)
print_result(t.timeit(COUNT), 'FastAVLTree build only')
t = Timer("avl_build_delete()", setup_AVLTree)
print_result(t.timeit(COUNT), 'AVLTree build & delete')
t = Timer("cavl_build_delete()", setup_FastAVLTree)
print_result(t.timeit(COUNT), 'FastAVLTree build & delete')
# shuffle search keys
shuffle(keys)
t = Timer("avl_search()", setup_AVLTree)
print_result(t.timeit(COUNT), 'AVLTree search')
t = Timer("cavl_search()", setup_FastAVLTree)
print_result(t.timeit(COUNT), 'FastAVLTree search')
评论列表
文章目录