From 2465db1eff7d1f7298cf9ca610d2d8722428407f Mon Sep 17 00:00:00 2001 From: Yudong Jin Date: Fri, 30 Dec 2022 15:57:15 +0800 Subject: [PATCH] Update space_complexity.md Fix the Go code. --- docs/chapter_computational_complexity/space_complexity.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/chapter_computational_complexity/space_complexity.md b/docs/chapter_computational_complexity/space_complexity.md index df5d98f34..e96c97209 100644 --- a/docs/chapter_computational_complexity/space_complexity.md +++ b/docs/chapter_computational_complexity/space_complexity.md @@ -219,11 +219,11 @@ comments: true ```go title="" func algorithm(n int) { - a := 0 // O(1) - b := make([]int, 10000) // O(1) + a := 0 // O(1) + b := make([]int, 10000) // O(1) var nums []int if n > 10 { - nums = make([]int, 10000) // O(n) + nums := make([]int, n) // O(n) } fmt.Println(a, b, nums) }