New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/dmichael/go-trie

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/dmichael/go-trie

  • v0.0.0-20170328152432-37dfab7ab4c9
  • Source
  • Go
  • Socket score

Version published
Created
Source

Trie

A simple trie in Golang

This implementation is derived (not transcribed) from the Java version as detailed in the excellent Algorithms by Robert Sedgewick and Kevin Wayne. I recommend this text without reservation. It is detailed, thorough, and very affordable.

Usage

If you would like to use this package, you may do something as follows. Please be aware this package may not be production ready and the implementation is incomplete.

package main

import (
	"fmt"

	"github.com/dmichael/go-trie/trie"
)

var dict = []string{"she", "sells", "sea", "shells", "by", "the", "sea", "shore"}

func main() {
	t := trie.NewTrie()
	for _, word := range dict {
		t.Put(word)
	}

	matches := t.KeysWithPrefix("she")
	fmt.Println(matches)
}

$ go run main.go
# => [she shells]

Constraints

  • Radix is hardcoded to 256 (ASCII)
  • Case-sensitive

TODO

  • Complete the GoDocs
  • Add pattern matching funcs

FAQs

Package last updated on 28 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc