mirror of
https://github.com/krahets/hello-algo.git
synced 2026-06-28 16:44:22 +00:00
d7b2277d2b
* Retranslate Japanese docs with GPT-5.4 * Retranslate Japanese code with GPT-5.4
27 lines
463 B
Go
27 lines
463 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)
|
|
}
|