A TernarySearchTree is a trie-like data structure that allows for efficient retrieval of strings. Each node has three children, representing less than, equal to, and greater than the current character.
import { TernarySearchTree } from "collection-kit";
import { TernarySearchTree } from "collection-kit";
const tst = new TernarySearchTree();
tst.insert("cat");
tst.insert("cats");
tst.insert("dog");
console.log(tst.search("cat")); // true
console.log(tst.search("car")); // false