Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/titsuki/raku-algorithm-ternarysearchtree
the algorithm which blends trie and binary search tree
https://github.com/titsuki/raku-algorithm-ternarysearchtree
Last synced: about 2 months ago
JSON representation
the algorithm which blends trie and binary search tree
- Host: GitHub
- URL: https://github.com/titsuki/raku-algorithm-ternarysearchtree
- Owner: titsuki
- License: artistic-2.0
- Created: 2016-02-28T07:46:19.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-08-08T14:04:27.000Z (5 months ago)
- Last Synced: 2024-10-11T20:54:38.700Z (3 months ago)
- Language: Raku
- Size: 17.6 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
[![Actions Status](https://github.com/titsuki/raku-Algorithm-TernarySearchTree/actions/workflows/test.yml/badge.svg)](https://github.com/titsuki/raku-Algorithm-TernarySearchTree/actions)
NAME
====Algorithm::TernarySearchTree - the algorithm which blends trie and binary search tree
SYNOPSIS
========use Algorithm::TernarySearchTree;
my $tst = Algorithm::TernarySearchTree.new();
$tst.insert("Perl6 is fun");
$tst.insert("Perl5 is fun");my $false-flag = $tst.contains("Kotlin is fun"); # False
my $true-flag = $tst.contains("Perl6 is fun"); # Truemy $matched = $tst.partial-match("Perl. is fun"); # set("Perl5 is fun","Perl6 is fun")
my $not-matched = $tst.partial-match("...lin is fun"); # set()DESCRIPTION
===========Algorithm::TernarySearchTree is a implementation of the ternary search tree. Ternary search tree is the algorithm which blends trie and binary search tree.
CONSTRUCTOR
-----------### new
my $tst = Algorithm::TernarySearchTree.new();
METHODS
-------### insert(Str $key)
$tst.insert($key);
Inserts the key to the tree.
### contains(Str $key) returns Bool:D
my $flag = $tst.contains($key);
Returns whether given key exists in the tree.
### partial-match(Str $fuzzy-key) returns Set:D
my Set $matched = $tst.partial-match($fuzzy-key);
Searches partially matched keys in the tree. If you want to match any character except record separator(hex: 0x1e), you can use dot symbol. For example, the query "Perl." matches "Perla", "Perl5", "Perl6", and so on.
METHODS NOT YET IMPLEMENTED
---------------------------near-search, traverse, and so on.
AUTHOR
======titsuki
COPYRIGHT AND LICENSE
=====================Copyright 2016 titsuki
This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.
This algorithm is from Bentley, Jon L., and Robert Sedgewick. "Fast algorithms for sorting and searching strings." SODA. Vol. 97. 1997.