https://github.com/awskii/splay
Non-recursive, simple and tested splay tree
https://github.com/awskii/splay
data-structures datastructures tree
Last synced: 6 days ago
JSON representation
Non-recursive, simple and tested splay tree
- Host: GitHub
- URL: https://github.com/awskii/splay
- Owner: awskii
- Created: 2018-01-16T13:16:21.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-01-16T13:16:38.000Z (over 8 years ago)
- Last Synced: 2025-01-17T01:15:25.330Z (over 1 year ago)
- Topics: data-structures, datastructures, tree
- Language: Go
- Size: 509 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
## Intro
Simple non-recursive realisation of a splay tree.
## Import
"github.com/awskii/splay"
## Key
By default, Key has type `int`, but you can change to fit your needs.
Key should be comparable.
## Tests
```
$ go test -cover
PASS
coverage: 94.6% of statements
ok github.com/awskii/splay 0.180s
```
## Benchmarks
```
$ go test -bench=. -benchmem
goos: darwin
goarch: amd64
pkg: github.com/awskii/splay
(4 CPU) (Elements) (time/op) (memory overhead)
BenchmarkInsertIdle-4 20000000 67.8 ns/op 32 B/op 1 allocs/op
BenchmarkSearchIdle-4 50000000 21.2 ns/op 0 B/op 0 allocs/op
BenchmarkInsertRandom-4 1000000 1576 ns/op 32 B/op 1 allocs/op
BenchmarkSearchRandom-4 1000000 1525 ns/op 0 B/op 0 allocs/op
```