Skip to content

Commit

Permalink
Add lang blocks in graph_traversal.md
Browse files Browse the repository at this point in the history
  • Loading branch information
krahets committed Feb 24, 2023
1 parent 2d421de commit f894199
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
28 changes: 21 additions & 7 deletions docs/chapter_graph/graph_traversal.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ BFS 常借助「队列」来实现。队列具有“先入先出”的性质,
=== "C++"

```cpp title="graph_bfs.cpp"

[class]{}-[func]{graphBFS}
```

=== "Python"
Expand All @@ -49,31 +49,31 @@ BFS 常借助「队列」来实现。队列具有“先入先出”的性质,
=== "Go"

```go title="graph_bfs.go"

[class]{}-[func]{graphBFS}
```

=== "JavaScript"

```javascript title="graph_bfs.js"

[class]{}-[func]{graphBFS}
```

=== "TypeScript"

```typescript title="graph_bfs.ts"

[class]{}-[func]{graphBFS}
```

=== "C"

```c title="graph_bfs.c"

[class]{}-[func]{graphBFS}
```

=== "C#"

```csharp title="graph_bfs.cs"

[class]{graph_bfs}-[func]{graphBFS}
```

=== "Swift"
Expand All @@ -85,7 +85,7 @@ BFS 常借助「队列」来实现。队列具有“先入先出”的性质,
=== "Zig"

```zig title="graph_bfs.zig"

[class]{}-[func]{graphBFS}
```

代码相对抽象,建议对照以下动画图示来加深理解。
Expand Down Expand Up @@ -154,7 +154,9 @@ BFS 常借助「队列」来实现。队列具有“先入先出”的性质,
=== "C++"

```cpp title="graph_dfs.cpp"
[class]{}-[func]{dfs}

[class]{}-[func]{graphDFS}
```

=== "Python"
Expand All @@ -168,31 +170,41 @@ BFS 常借助「队列」来实现。队列具有“先入先出”的性质,
=== "Go"

```go title="graph_dfs.go"
[class]{}-[func]{dfs}

[class]{}-[func]{graphDFS}
```

=== "JavaScript"

```javascript title="graph_dfs.js"
[class]{}-[func]{dfs}

[class]{}-[func]{graphDFS}
```

=== "TypeScript"

```typescript title="graph_dfs.ts"
[class]{}-[func]{dfs}

[class]{}-[func]{graphDFS}
```

=== "C"

```c title="graph_dfs.c"
[class]{}-[func]{dfs}

[class]{}-[func]{graphDFS}
```

=== "C#"

```csharp title="graph_dfs.cs"
[class]{graph_dfs}-[func]{dfs}

[class]{graph_dfs}-[func]{graphDFS}
```

=== "Swift"
Expand All @@ -206,7 +218,9 @@ BFS 常借助「队列」来实现。队列具有“先入先出”的性质,
=== "Zig"

```zig title="graph_dfs.zig"
[class]{}-[func]{dfs}

[class]{}-[func]{graphDFS}
```

深度优先遍历的算法流程如下图所示,其中
Expand Down
6 changes: 3 additions & 3 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ nav:
- 0.2.   如何使用本书: chapter_preface/suggestions.md
- 0.3.   编程环境安装: chapter_preface/installation.md
- 0.4.   一起参与创作: chapter_preface/contribution.md
- 1.     引言:
- 1.     引言:
- 1.1.   算法无处不在: chapter_introduction/algorithms_are_everywhere.md
- 1.2.   算法是什么: chapter_introduction/what_is_dsa.md
- 2.     计算复杂度:
Expand All @@ -138,11 +138,11 @@ nav:
- 2.3.   空间复杂度: chapter_computational_complexity/space_complexity.md
- 2.4.   权衡时间与空间: chapter_computational_complexity/space_time_tradeoff.md
- 2.5.   小结: chapter_computational_complexity/summary.md
- 3.     数据结构简介:
- 3.     数据结构简介:
- 3.1.   数据与内存: chapter_data_structure/data_and_memory.md
- 3.2.   数据结构分类: chapter_data_structure/classification_of_data_structure.md
- 3.3.   小结: chapter_data_structure/summary.md
- 4.     数组与链表:
- 4.     数组与链表:
- 4.1.   数组(Array): chapter_array_and_linkedlist/array.md
- 4.2.   链表(LinkedList): chapter_array_and_linkedlist/linked_list.md
- 4.3.   列表(List): chapter_array_and_linkedlist/list.md
Expand Down

0 comments on commit f894199

Please sign in to comment.