本文整理汇总了Python中btNode.BTNode.right方法的典型用法代码示例。如果您正苦于以下问题:Python BTNode.right方法的具体用法?Python BTNode.right怎么用?Python BTNode.right使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类btNode.BTNode
的用法示例。
在下文中一共展示了BTNode.right方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test1
# 需要导入模块: from btNode import BTNode [as 别名]
# 或者: from btNode.BTNode import right [as 别名]
def test1():
n1 = BTNode(1)
n2 = BTNode(2)
n3 = BTNode(3)
n4 = BTNode(4)
n5 = BTNode(5)
n6 = BTNode(6)
n7 = BTNode(7)
n8 = BTNode(8)
n9 = BTNode(9)
n10 = BTNode(10)
n11 = BTNode(11)
n1.left = n2
n1.right = n3
n2.left = n4
n2.right = n5
n4.left = n6
n4.right = n7
n3.left = n8
n3.right = n9
n8.left = n10
n8.right = n11
print(pot(n1))
print(pot_stack(n1))
示例2: test1
# 需要导入模块: from btNode import BTNode [as 别名]
# 或者: from btNode.BTNode import right [as 别名]
def test1():
n7 = BTNode(7)
n10 = BTNode(10)
n4 = BTNode(4)
n3 = BTNode(3)
n1 = BTNode(1)
n2 = BTNode(2)
n8 = BTNode(8)
n11 = BTNode(11)
n7.left = n10
n7.right = n2
n10.left = n4
n10.right = n3
n3.right = n1
n2.left = n8
n8.left = n11
BTNode.print_nodes(n7)
print('-----------------------------')
post_o = [4, 1, 3, 10, 11, 8, 2, 7]
in_o = [4, 10, 3, 1, 7, 11, 8, 2]
BTNode.print_nodes(buildT(post_o, in_o))
print('-----------------------------')
post_o = [4, 1, 3, 10, 11, 8, 2, 7]
in_o = [4, 10, 3, 1, 7, 11, 8, 2]
BTNode.print_nodes(buildTFaster(post_o, in_o))
print('-----------------------------')
示例3: test1
# 需要导入模块: from btNode import BTNode [as 别名]
# 或者: from btNode.BTNode import right [as 别名]
def test1():
n15 = BTNode(15)
n7 = BTNode(7)
n30 = BTNode(30)
n11 = BTNode(11)
n9 = BTNode(9)
n8 = BTNode(8)
n10 = BTNode(10)
n14 = BTNode(14)
n13 = BTNode(13)
n12 = BTNode(12)
n15.left = n7
n15.right = n30
n7.right = n11
n11.left = n9
n11.right = n14
n9.left = n8
n9.right = n10
n11.right = n14
n14.left = n13
n13.left = n12
print(lcaBST(n15, n8, n12).val)
print(lcaBST(n15, n13, n12).val)
print(lcaBST(n15, n7, n12).val)
示例4: test3
# 需要导入模块: from btNode import BTNode [as 别名]
# 或者: from btNode.BTNode import right [as 别名]
def test3():
n1 = BTNode(1)
n2 = BTNode(2)
n3 = BTNode(3)
n1.right = n2
n2.right = n3
flatten(n1)
BTNode.print_nodes(n1)
示例5: test1
# 需要导入模块: from btNode import BTNode [as 别名]
# 或者: from btNode.BTNode import right [as 别名]
def test1():
n3 = BTNode(3)
n9 = BTNode(9)
n20 = BTNode(20)
n15 = BTNode(15)
n7 = BTNode(7)
n3.left = n9
n3.right = n20
n20.left = n15
n20.right = n7
print(zzTrav(n3))
示例6: test2
# 需要导入模块: from btNode import BTNode [as 别名]
# 或者: from btNode.BTNode import right [as 别名]
def test2():
n1 = BTNode(1)
n2 = BTNode(2)
n3 = BTNode(3)
n4 = BTNode(4)
n1.left = n2
n2.right = n4
n1.right = n3
print(constructStr(n1))
print(constructStr2_top(n1))
示例7: test2
# 需要导入模块: from btNode import BTNode [as 别名]
# 或者: from btNode.BTNode import right [as 别名]
def test2():
n1 = BTNode(1)
n2 = BTNode(2)
n3 = BTNode(3)
n4 = BTNode(4)
n1.right = n2
n2.right = n3
n3.right = n4
print(postOrderT(n1))
print(postOrderT_r(n1))
print(postOrderT_Alt_r(n1))
示例8: test1
# 需要导入模块: from btNode import BTNode [as 别名]
# 或者: from btNode.BTNode import right [as 别名]
def test1():
n3 = BTNode(3)
n9 = BTNode(9)
n20 = BTNode(20)
n15 = BTNode(15)
n7 = BTNode(7)
n3.left = n9
n3.right = n20
n20.left = n15
n20.right = n7
lst = []
lot(n3, 0, lst)
print(lst)
示例9: test1
# 需要导入模块: from btNode import BTNode [as 别名]
# 或者: from btNode.BTNode import right [as 别名]
def test1():
n1 = BTNode(1)
n2 = BTNode(2)
n3 = BTNode(3)
n4 = BTNode(4)
n5 = BTNode(5)
n6 = BTNode(6)
n3.left = n2
n3.right = n5
n2.left = n1
n5.left = n4
n5.right = n6
print(isBalBST(n3))
示例10: test2
# 需要导入模块: from btNode import BTNode [as 别名]
# 或者: from btNode.BTNode import right [as 别名]
def test2():
n1 = BTNode(1)
n2 = BTNode(2)
n3 = BTNode(3)
n4 = BTNode(4)
n5 = BTNode(5)
n1.left = n2
n2.right = n3
n3.right = n4
n4.left = n5
lst = []
lot(n1, 0, lst)
print(lst)
示例11: test2
# 需要导入模块: from btNode import BTNode [as 别名]
# 或者: from btNode.BTNode import right [as 别名]
def test2():
n1 = BTNode(1)
n2 = BTNode(2)
n3 = BTNode(3)
n4 = BTNode(4)
n5 = BTNode(5)
n6 = BTNode(6)
n7 = BTNode(7)
n1.left = n2
n1.right = n3
n2.left = n4
n2.right = n5
n3.left = n6
n3.right = n7
print(sumRoot2LeafNumbers(n1))
示例12: buildTHelper
# 需要导入模块: from btNode import BTNode [as 别名]
# 或者: from btNode.BTNode import right [as 别名]
def buildTHelper(post_o, in_o, idx_dic, beg, end):
if beg < end:
mid = idx_dic[post_o.pop()]
n = BTNode(in_o[mid])
n.right = buildTHelper(post_o, in_o, idx_dic, mid+1, end)
n.left = buildTHelper(post_o, in_o, idx_dic, beg, mid)
return n
示例13: test2
# 需要导入模块: from btNode import BTNode [as 别名]
# 或者: from btNode.BTNode import right [as 别名]
def test2():
n5 = BTNode(5)
n2 = BTNode(2)
nm5 = BTNode(-5)
n5.left = n2
n5.right = nm5
print(mfss(n5))
示例14: test1
# 需要导入模块: from btNode import BTNode [as 别名]
# 或者: from btNode.BTNode import right [as 别名]
def test1():
n1 = BTNode(1)
n2 = BTNode(2)
n3 = BTNode(3)
n4 = BTNode(4)
n5 = BTNode(5)
n7 = BTNode(7)
n1.left = n2
n1.right = n3
n2.left = n4
n2.right = n5
n5.right = n7
rslt = []
inOrderTrav(n1, rslt)
print(rslt)
print(inOrderTravRec(n1))
print("--------------")
示例15: test1
# 需要导入模块: from btNode import BTNode [as 别名]
# 或者: from btNode.BTNode import right [as 别名]
def test1():
n5 = BTNode(5)
n2 = BTNode(2)
nm3 = BTNode(-3)
n5.left = n2
n5.right = nm3
print(mfss(n5))