diff --git a/docs-en/chapter_computational_complexity/space_complexity.md b/docs-en/chapter_computational_complexity/space_complexity.md index 239a27ae1..337a7b9b9 100644 --- a/docs-en/chapter_computational_complexity/space_complexity.md +++ b/docs-en/chapter_computational_complexity/space_complexity.md @@ -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 } ``` diff --git a/docs/chapter_computational_complexity/space_complexity.md b/docs/chapter_computational_complexity/space_complexity.md index 7b48b00ef..44b7fa68b 100755 --- a/docs/chapter_computational_complexity/space_complexity.md +++ b/docs/chapter_computational_complexity/space_complexity.md @@ -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 } ``` diff --git a/docs/chapter_preface/about_the_book.md b/docs/chapter_preface/about_the_book.md index 6123bfe20..e04986431 100644 --- a/docs/chapter_preface/about_the_book.md +++ b/docs/chapter_preface/about_the_book.md @@ -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)的启发。在此向各位读者强烈推荐这本优秀的著作。 diff --git a/docs/index.md b/docs/index.md index 5be644fc3..96116a856 100644 --- a/docs/index.md +++ b/docs/index.md @@ -8,8 +8,8 @@ hide: ---