本文整理汇总了Python中Tree.insert方法的典型用法代码示例。如果您正苦于以下问题:Python Tree.insert方法的具体用法?Python Tree.insert怎么用?Python Tree.insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree
的用法示例。
在下文中一共展示了Tree.insert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Counter
# 需要导入模块: import Tree [as 别名]
# 或者: from Tree import insert [as 别名]
from random import randint
from math import log
import numpy as np
c = Counter()
count = []
logn = []
for k in range(1,50):
n = int(5*((1.2)**k))
j = randint(1,n)
N = Tree(c)
logn.append(log(n))
for i in range(1,n+1):
j = randint(1,n)
N.insert(j)
#N.delete(N.root)
avg = N.c.query()/n
N.c.reset()
count.append(avg)
#inorder(N.root)
#print(count)
import matplotlib.pyplot as plt
logn = np.array(logn)
count = np.array(count)
plt.subplot(1,1,1)
示例2: Tree
# 需要导入模块: import Tree [as 别名]
# 或者: from Tree import insert [as 别名]
# coding=utf-8
from Tree import *
Hua = Tree('Hua')
JuHua = Hua.insert(Tree('JuHua'))
LanHua = Hua.insert(Tree('LanHua'))
TieJuHua = Hua[JuHua].insert(Tree('TieJuHua'))
JuHuaTie = Hua[JuHua].insert(Tree('JuHuaTie'))
GangTieDaJuHua = Hua[TieJuHua].insert(Tree('GangTieDaJueHua'))
BaoJuHua = Hua[TieJuHua].insert(Tree('BaoJuHua'))
JuHuaCan = Hua[JuHuaTie].insert(Tree('JuHuaCan'))
XiaoLanHua = Hua[LanHua].insert(Tree('XiaoLanHua'))
MaoLiLan = Hua[XiaoLanHua].insert(Tree('MaoLiLan'))
print Hua