Fix space_complexity.md
This commit is contained in:
parent
b37a088f7d
commit
d09b1e4f9f
@ -87,10 +87,11 @@
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
def algorithm(n) -> int: # 输入数据
|
def algorithm(n) -> int: # 输入数据
|
||||||
|
A: int = 0 # 暂存数据(常量,一般用大写字母表示)
|
||||||
b: int = 0 # 暂存数据(变量)
|
b: int = 0 # 暂存数据(变量)
|
||||||
node = Node(0) # 暂存数据(对象)
|
node = Node(0) # 暂存数据(对象)
|
||||||
c: int = function() # 栈帧空间(调用函数)
|
c: int = function() # 栈帧空间(调用函数)
|
||||||
return a + b + c # 输出数据
|
return A + b + c # 输出数据
|
||||||
```
|
```
|
||||||
|
|
||||||
=== "Go"
|
=== "Go"
|
||||||
@ -143,7 +144,7 @@
|
|||||||
|
|
||||||
function algorithm(n) { // 输入数据
|
function algorithm(n) { // 输入数据
|
||||||
const a = 0; // 暂存数据(常量)
|
const a = 0; // 暂存数据(常量)
|
||||||
const b = 0; // 暂存数据(变量)
|
let b = 0; // 暂存数据(变量)
|
||||||
const node = new Node(0); // 暂存数据(对象)
|
const node = new Node(0); // 暂存数据(对象)
|
||||||
const c = constFunc(); // 栈帧空间(调用函数)
|
const c = constFunc(); // 栈帧空间(调用函数)
|
||||||
return a + b + c; // 输出数据
|
return a + b + c; // 输出数据
|
||||||
@ -171,7 +172,7 @@
|
|||||||
|
|
||||||
function algorithm(n: number): number { // 输入数据
|
function algorithm(n: number): number { // 输入数据
|
||||||
const a = 0; // 暂存数据(常量)
|
const a = 0; // 暂存数据(常量)
|
||||||
const b = 0; // 暂存数据(变量)
|
let b = 0; // 暂存数据(变量)
|
||||||
const node = new Node(0); // 暂存数据(对象)
|
const node = new Node(0); // 暂存数据(对象)
|
||||||
const c = constFunc(); // 栈帧空间(调用函数)
|
const c = constFunc(); // 栈帧空间(调用函数)
|
||||||
return a + b + c; // 输出数据
|
return a + b + c; // 输出数据
|
||||||
@ -204,7 +205,7 @@
|
|||||||
|
|
||||||
int algorithm(int n) // 输入数据
|
int algorithm(int n) // 输入数据
|
||||||
{
|
{
|
||||||
int a = 0; // 暂存数据(常量)
|
const int a = 0; // 暂存数据(常量)
|
||||||
int b = 0; // 暂存数据(变量)
|
int b = 0; // 暂存数据(变量)
|
||||||
Node node = new Node(0); // 暂存数据(对象)
|
Node node = new Node(0); // 暂存数据(对象)
|
||||||
int c = function(); // 栈帧空间(调用函数)
|
int c = function(); // 栈帧空间(调用函数)
|
||||||
@ -232,11 +233,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
func algorithm(n: Int) -> Int { // 输入数据
|
func algorithm(n: Int) -> Int { // 输入数据
|
||||||
let a = 0 // 暂存数据(常量)
|
let a = 0 // 暂存数据(常量)
|
||||||
var b = 0 // 暂存数据(变量)
|
var b = 0 // 暂存数据(变量)
|
||||||
let node = Node(x: 0) // 暂存数据(对象)
|
let node = Node(x: 0) // 暂存数据(对象)
|
||||||
let c = function() // 栈帧空间(调用函数)
|
let c = function() // 栈帧空间(调用函数)
|
||||||
return a + b + c // 输出数据
|
return a + b + c // 输出数据
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user