Skip to content

Instantly share code, notes, and snippets.

@greyscaled
Created August 20, 2018 03:58
Show Gist options
  • Save greyscaled/e6788814170fe7a535400f9521ccfd66 to your computer and use it in GitHub Desktop.
Save greyscaled/e6788814170fe7a535400f9521ccfd66 to your computer and use it in GitHub Desktop.
const recursiveInsert = (node, key, val, d) => {
if (!node) node = new Node()
if (d === key.length) {
node.value = val
return node
}
let c = Base26.getBase26Digit(key[d])
node.next[c] = recursiveInsert(node.next[c], key, val, d + 1)
return node
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment