How to use
If js-data-structs
is installed as a npm package then use a require statement.
const ds = require('./node_modules/js-data-structs/DataStructures.min.js')
var tr = ds.Trie()
var list = ["the", "a", "there", "answer", "any","by", "bye", "their"]
list.forEach(word => {
tr.insertWord(word)
})
console.log(tr.search("there"))
If your project includes it as a script tag then just start using it directly
var tr = Trie()
var list = ["the", "a", "there", "answer", "any","by", "bye", "their"]
list.forEach(word => {
tr.insertWord(word)
})
console.log(tr.search("there"))