mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-26 03:16:29 +08:00
b9ae4ffe9a
* fix(csharp): unified array statement * feature: add workflow for go/js/ts/zig * fix python UnicodeDecodeError on windows * Update space_complexity.go * Update space_complexity_test.go * Update space_complexity.go * remove nodejs, zip workflow --------- Co-authored-by: Yudong Jin <krahets@163.com>
26 lines
454 B
Go
26 lines
454 B
Go
// File: space_complexity_test.go
|
|
// Created Time: 2022-12-15
|
|
// Author: cathay (cathaycchen@gmail.com)
|
|
|
|
package chapter_computational_complexity
|
|
|
|
import (
|
|
"testing"
|
|
|
|
. "github.com/krahets/hello-algo/pkg"
|
|
)
|
|
|
|
func TestSpaceComplexity(t *testing.T) {
|
|
n := 5
|
|
// 常数阶
|
|
spaceConstant(n)
|
|
// 线性阶
|
|
spaceLinear(n)
|
|
spaceLinearRecur(n)
|
|
// 平方阶
|
|
spaceQuadratic(n)
|
|
spaceQuadraticRecur(n)
|
|
// 指数阶
|
|
root := buildTree(n)
|
|
PrintTree(root)
|
|
}
|