Testing Space Complexity Implementations in hello-algo
This test suite evaluates space complexity implementations across different algorithmic patterns in Go. It validates various space complexity scenarios including constant, linear, quadratic, and exponential complexity cases through both iterative and recursive approaches.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
krahets/hello-algo
zh-hant/codes/go/chapter_computational_complexity/space_complexity_test.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)
}