mirror of
https://github.com/krahets/hello-algo.git
synced 2026-06-29 09:04:23 +00:00
772183705e
* Add Russian docs site baseline * Add Russian localized codebase * Polish Russian code wording * Update ru code translation. * Update code translation and chapter covers. * Fix pythontutor extraction. * Add README and landing page. * placeholder of profiles * Use figures of English version * Remove chapter paperbook
27 lines
586 B
Go
27 lines
586 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)
|
|
}
|