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

Method show_diff

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

Source from the content-addressed store, hash-verified

23 self.group.append(i)
24
25 def show_diff(self):
26 self.show_message("首先,让我们来看看区间问题的常见3个解法")
27
28 table = AlgoTable(self, np.array([
29 ["", "区间求和", "区间最大值", "区间修改", "单点修改"],
30 ["前缀和", AlgoCheckmark(), AlgoExmark(), AlgoExmark(), AlgoExmark(),],
31 ["树状数组", AlgoCheckmark(), AlgoCheckmark(), AlgoExmark(), AlgoCheckmark(),],
32 ["线段树", AlgoCheckmark(), AlgoCheckmark(), AlgoCheckmark(), AlgoCheckmark(),],
33 ], dtype=object))
34
35 self.play(ShowCreation(table), run_time=4)
36
37 rect = SurroundingRectangle(table)
38 self.play(ShowCreation(rect))
39
40 self.show_message("前缀和、树状数组、线段树")
41
42 self.show_message("前缀和一般用于固定的数组")
43
44 self.show_message("树状数组是一种很高效的数据结构")
45 self.show_message("功能能满足大部分需求")
46
47 self.show_message("线段树则是一种非常灵活的数据结构")
48 self.show_message("本动画重点讲解线段树")
49 self.play(FadeOut(table), FadeOut(rect))
50
51 def what_is_segment_tree(self):
52 self.show_message("线段树是一棵树")

Callers 1

constructMethod · 0.95

Calls 4

AlgoTableClass · 0.85
AlgoCheckmarkClass · 0.85
AlgoExmarkClass · 0.85
show_messageMethod · 0.45

Tested by

no test coverage detected