This commit is contained in:
krahets 2024-01-12 15:20:39 +08:00
parent d9250b73b6
commit 97f3be5bc8
4 changed files with 21 additions and 15 deletions

View file

@ -849,7 +849,7 @@ Note that memory occupied by initializing variables or calling functions in a lo
const a = 0
b := 0
nums := make([]int, 10000)
ListNode := newNode(0)
node := newNode(0)
// 循环中的变量占用 O(1) 空间
var c int
for i := 0; i < n; i++ {
@ -859,7 +859,10 @@ Note that memory occupied by initializing variables or calling functions in a lo
for i := 0; i < n; i++ {
function()
}
fmt.Println(a, b, nums, c, ListNode)
b += 0
c += 0
nums[0] = 0
node.val = 0
}
```
@ -1938,13 +1941,13 @@ Exponential order is common in binary trees. Observe the below image, a "full bi
```go title="space_complexity.go"
/* 指数阶(建立满二叉树) */
func buildTree(n int) *treeNode {
func buildTree(n int) *TreeNode {
if n == 0 {
return nil
}
root := newTreeNode(0)
root.left = buildTree(n - 1)
root.right = buildTree(n - 1)
root := NewTreeNode(0)
root.Left = buildTree(n - 1)
root.Right = buildTree(n - 1)
return root
}
```

View file

@ -848,7 +848,7 @@ $$
const a = 0
b := 0
nums := make([]int, 10000)
ListNode := newNode(0)
node := newNode(0)
// 循环中的变量占用 O(1) 空间
var c int
for i := 0; i < n; i++ {
@ -858,7 +858,10 @@ $$
for i := 0; i < n; i++ {
function()
}
fmt.Println(a, b, nums, c, ListNode)
b += 0
c += 0
nums[0] = 0
node.val = 0
}
```
@ -1937,13 +1940,13 @@ $$
```go title="space_complexity.go"
/* 指数阶(建立满二叉树) */
func buildTree(n int) *treeNode {
func buildTree(n int) *TreeNode {
if n == 0 {
return nil
}
root := newTreeNode(0)
root.left = buildTree(n - 1)
root.right = buildTree(n - 1)
root := NewTreeNode(0)
root.Left = buildTree(n - 1)
root.Right = buildTree(n - 1)
return root
}
```

View file

@ -49,7 +49,7 @@ comments: true
- 感谢苏潼为本书设计了精美的封面和 logo ,并在我的强迫症的驱使下多次耐心修改;
- 感谢 @squidfunk 提供的排版建议,以及他开发的开源文档主题 [Material-for-MkDocs](https://github.com/squidfunk/mkdocs-material/tree/master) 。
在写作过程中,我阅读了许多关于数据结构与算法的教材和文章。这些作品为本书提供了优秀的范本,确保了本书内容的准确性与品质。在此感谢所有老师和前辈的杰出贡献!
在写作过程中,我阅读了许多关于数据结构与算法的教材和文章。这些作品为本书提供了优秀的范本,确保了本书内容的准确性与品质。在此感谢所有老师和前辈的杰出贡献!
本书倡导手脑并用的学习方式,在这一点上我深受[《动手学深度学习》](https://github.com/d2l-ai/d2l-zh)的启发。在此向各位读者强烈推荐这本优秀的著作。

View file

@ -8,8 +8,8 @@ hide:
---
<div class="header-img-div" style="max-width: 500px;">
<img src="index.assets/conceptual_rendering.png" style="width: 37%; height: auto; margin-right:15px;">
<img src="index.assets/hello_algo_mindmap_tp.png" style="width: 63%; height: auto; margin-left:15px;">
<img src="index.assets/conceptual_rendering.png" style="width: 37%; height: auto; margin-left: 15px; margin-right: 15px;">
<img src="index.assets/hello_algo_mindmap_tp.png" style="width: 63%; height: auto; margin-left: 15px; margin-right: 15px;">
</div>
<h2 align="center">《 Hello 算法 》</h2>