go-radix

Golang implementation of Radix trees

  • Owner: armon/go-radix
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

go-radix Build Status

Provides the radix package that implements a 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.

Documentation

The full documentation is available on Godoc.

Example

Below is a simple example of usage

// 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")
}

Main metrics

Overview
Name With Ownerarmon/go-radix
Primary LanguageGo
Program languageGo (Language Count: 1)
Platform
License:MIT License
所有者活动
Created At2014-08-01 01:40:30
Pushed At2024-07-06 07:38:33
Last Commit At2022-11-18 10:45:46
Release Count1
Last Release Namev1.0.0 (Posted on )
First Release Namev1.0.0 (Posted on )
用户参与
Stargazers Count0.9k
Watchers Count20
Fork Count102
Commits Count36
Has Issues Enabled
Issues Count11
Issue Open Count2
Pull Requests Count10
Pull Requests Open Count2
Pull Requests Close Count4
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private