mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 21:24:53 +08:00
feature: add auto-build-and-test workflow for go (#1019)
* 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>
This commit is contained in:
@ -6,25 +6,21 @@ package chapter_computational_complexity
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "github.com/krahets/hello-algo/pkg"
|
||||
)
|
||||
|
||||
func TestSpaceComplexity(t *testing.T) {
|
||||
/* ======= Test Case ======= */
|
||||
n := 5
|
||||
|
||||
/* ====== Driver Code ====== */
|
||||
// 常数阶
|
||||
spaceConstant(n)
|
||||
|
||||
// 线性阶
|
||||
spaceLinear(n)
|
||||
spaceLinearRecur(n)
|
||||
|
||||
// 平方阶
|
||||
spaceQuadratic(n)
|
||||
spaceQuadraticRecur(n)
|
||||
|
||||
// 指数阶
|
||||
root := buildTree(n)
|
||||
printTree(root)
|
||||
PrintTree(root)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user