Lazy insertion in Hash array mapped trie

Lorenzo Tinfena
Aug 22, 2023

--

Instead of traverse and create node until reach a leaf node in the trie, you can simply just add the value in the first newly created node.

But for each node you should check if current node has the same hash, if yes append the value in that node, else continue.

This could be a good improvement for small amount of insertions.

Implementation: https://github.com/lorenzotinfena/goji/blob/main/collections/trie/hamt.go

--

--

Lorenzo Tinfena
Lorenzo Tinfena

Written by Lorenzo Tinfena

Computer science student - Artificial intelligence enthusiast. https://github.com/lorenzotinfena

No responses yet