kjx98 / go-avl

avl written by golang w/ generic, forked from https://github.com/Yawning

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AVL - AVL tree

Jesse Kuang (jkuang at 21cn dot com)

GoDoc

A generic type Go AVL tree implementation, forked from Yawning Angel, derived from Eric Biggers' C code, in the spirt of the runtime library's containers.

Features:

  • Size
  • Insertion
  • Deletion
  • Search
  • In-order traversal (forward and backward) with an iterator or callback.
  • Non-recursive.

Generic Improve:

  • Generic type improved over 20% compared to interface{} generic func
  • Benchmark cmp
benchmark                  old ns/op     new ns/op     delta
BenchmarkAVLInsert         1003          674           -32.83%
BenchmarkAVLFind           880           687           -21.92%
BenchmarkAVLDeleteLeft     0.16          69.0          +42812.26%

Note:

  • The package itself is free from external dependencies, the unit tests use testify. dependencies removed

About

avl written by golang w/ generic, forked from https://github.com/Yawning

License:Creative Commons Zero v1.0 Universal


Languages

Language:Go 100.0%