go-radix
所属分类:collect
开发工具:GO
文件大小:0KB
下载次数:0
上传日期:2023-05-23 13:51:45
上 传 者:
sh-1993
说明: 果郎实施红木,
(Golang implementation of Radix trees,)
文件列表:
.travis.yml (53, 2022-11-18)
LICENSE (1079, 2022-11-18)
go.mod (33, 2022-11-18)
radix.go (11462, 2022-11-18)
radix_test.go (7297, 2022-11-18)
go-radix [![Build Status](https://travis-ci.org/armon/go-radix.png)](https://travis-ci.org/armon/go-radix)
=========
Provides the `radix` package that implements a [radix tree](http://en.wikipedia.org/wiki/Radix_tree).
The package only provides a single `Tree` implementation, optimized for sparse nodes.
As a radix tree, it provides the following:
* O(k) operations. In many cases, this can be faster than a hash table since
the hash function is an O(k) operation, and hash tables have very poor cache locality.
* Minimum / Maximum value lookups
* Ordered iteration
For an immutable variant, see [go-immutable-radix](https://github.com/hashicorp/go-immutable-radix).
Documentation
=============
The full documentation is available on [Godoc](http://godoc.org/github.com/armon/go-radix).
Example
=======
Below is a simple example of usage
```go
// Create a tree
r := radix.New()
r.Insert("foo", 1)
r.Insert("bar", 2)
r.Insert("foobar", 2)
// Find the longest prefix match
m, _, _ := r.LongestPrefix("foozip")
if m != "foo" {
panic("should be foo")
}
```
近期下载者:
相关文件:
收藏者: