mirror of
https://github.com/krahets/hello-algo.git
synced 2026-11-02 03:05:24 +08:00
* Retranslate the complete Japanese online edition from Chinese * Fit Japanese homepage labels and localize heading permalinks * Point Japanese contribution instructions to the Japanese preview * Replace locale conditionals with multilingual UI tables
27 lines
490 B
Go
27 lines
490 B
Go
// File: space_complexity_test.go
|
|
// Created Time: 2022-12-15
|
|
// Author: cathay ([email protected])
|
|
|
|
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)
|
|
}
|