mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-08 13:36:06 +00:00
Add animation player (#1877)
* Add auto slide controller. * Fix the animation blocks. * renamed as animation_player * Bug fixes * Refine animation player controls
This commit is contained in:
@@ -11,19 +11,19 @@
|
||||
- **删除顶点**:在邻接矩阵中删除一行一列。当删除首行首列时达到最差情况,需要将 $(n-1)^2$ 个元素“向左上移动”,从而使用 $O(n^2)$ 时间。
|
||||
- **初始化**:传入 $n$ 个顶点,初始化长度为 $n$ 的顶点列表 `vertices` ,使用 $O(n)$ 时间;初始化 $n \times n$ 大小的邻接矩阵 `adjMat` ,使用 $O(n^2)$ 时间。
|
||||
|
||||
=== "初始化邻接矩阵"
|
||||
=== "<1>"
|
||||

|
||||
|
||||
=== "添加边"
|
||||
=== "<2>"
|
||||

|
||||
|
||||
=== "删除边"
|
||||
=== "<3>"
|
||||

|
||||
|
||||
=== "添加顶点"
|
||||
=== "<4>"
|
||||

|
||||
|
||||
=== "删除顶点"
|
||||
=== "<5>"
|
||||

|
||||
|
||||
以下是基于邻接矩阵表示图的实现代码:
|
||||
@@ -42,19 +42,19 @@
|
||||
- **删除顶点**:需遍历整个邻接表,删除包含指定顶点的所有边,使用 $O(n + m)$ 时间。
|
||||
- **初始化**:在邻接表中创建 $n$ 个顶点和 $2m$ 条边,使用 $O(n + m)$ 时间。
|
||||
|
||||
=== "初始化邻接表"
|
||||
=== "<1>"
|
||||

|
||||
|
||||
=== "添加边"
|
||||
=== "<2>"
|
||||

|
||||
|
||||
=== "删除边"
|
||||
=== "<3>"
|
||||

|
||||
|
||||
=== "添加顶点"
|
||||
=== "<4>"
|
||||

|
||||
|
||||
=== "删除顶点"
|
||||
=== "<5>"
|
||||

|
||||
|
||||
以下是邻接表的代码实现。对比上图,实际代码有以下不同。
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 22 KiB |
Reference in New Issue
Block a user