MCPcopy Create free account
hub / github.com/acm-clan/algorithm-stone / construct

Method construct

animations/segmenttree.py:77–94  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

75 self.datas = np.array([1, 2, 3, 4, 5, 6])
76
77 def construct(self):
78 self.start_logo(animate=False)
79
80 self.init_message("线段树是一棵树,从数组进行构造")
81
82 array = AlgoVector(self, self.datas)
83 array.shift(UP)
84 self.play(ShowCreation(array))
85 self.play(array.to_edge, LEFT)
86
87 tree = AlgoSegTree(self, self.datas)
88 tree.shift(UP*0.5).scale(0.9)
89 self.play(ShowCreation(tree))
90 self.play(tree.to_edge, RIGHT)
91
92 self.show_message("问题规约:给你一个数组,将数组元素放到叶子节点,父节点为左右子树的和")
93 #
94 self.wait()
95
96class SegmentTreeBase(AlgoScene):
97 def __init__(self, **kwargs):

Callers

nothing calls this directly

Calls 6

AlgoVectorClass · 0.85
AlgoSegTreeClass · 0.85
start_logoMethod · 0.80
init_messageMethod · 0.80
scaleMethod · 0.45
show_messageMethod · 0.45

Tested by

no test coverage detected