diff --git a/docs/chapter_computational_complexity/space_complexity.md b/docs/chapter_computational_complexity/space_complexity.md index ea51e4c56..3cdd1a8a5 100755 --- a/docs/chapter_computational_complexity/space_complexity.md +++ b/docs/chapter_computational_complexity/space_complexity.md @@ -87,10 +87,11 @@ return 0 def algorithm(n) -> int: # 输入数据 + A: int = 0 # 暂存数据(常量,一般用大写字母表示) b: int = 0 # 暂存数据(变量) node = Node(0) # 暂存数据(对象) c: int = function() # 栈帧空间(调用函数) - return a + b + c # 输出数据 + return A + b + c # 输出数据 ``` === "Go" @@ -143,7 +144,7 @@ function algorithm(n) { // 输入数据 const a = 0; // 暂存数据(常量) - const b = 0; // 暂存数据(变量) + let b = 0; // 暂存数据(变量) const node = new Node(0); // 暂存数据(对象) const c = constFunc(); // 栈帧空间(调用函数) return a + b + c; // 输出数据 @@ -171,7 +172,7 @@ function algorithm(n: number): number { // 输入数据 const a = 0; // 暂存数据(常量) - const b = 0; // 暂存数据(变量) + let b = 0; // 暂存数据(变量) const node = new Node(0); // 暂存数据(对象) const c = constFunc(); // 栈帧空间(调用函数) return a + b + c; // 输出数据 @@ -204,7 +205,7 @@ int algorithm(int n) // 输入数据 { - int a = 0; // 暂存数据(常量) + const int a = 0; // 暂存数据(常量) int b = 0; // 暂存数据(变量) Node node = new Node(0); // 暂存数据(对象) int c = function(); // 栈帧空间(调用函数) @@ -232,11 +233,11 @@ } func algorithm(n: Int) -> Int { // 输入数据 - let a = 0 // 暂存数据(常量) - var b = 0 // 暂存数据(变量) + let a = 0 // 暂存数据(常量) + var b = 0 // 暂存数据(变量) let node = Node(x: 0) // 暂存数据(对象) - let c = function() // 栈帧空间(调用函数) - return a + b + c // 输出数据 + let c = function() // 栈帧空间(调用函数) + return a + b + c // 输出数据 } ```