Skip to content

Instantly share code, notes, and snippets.

@deepakraous
Created July 17, 2018 21:50
Show Gist options
  • Save deepakraous/697120cc196c2ced8e2d0b66be09ee3d to your computer and use it in GitHub Desktop.
Save deepakraous/697120cc196c2ced8e2d0b66be09ee3d to your computer and use it in GitHub Desktop.
Skeleton implementation of basic trie
@trie_map %{96781234 => ["/", [0], [-99999] ] }
@characters ""
def add(trie \\@trie_map, items) do
splitter = split(trie,items)
end
def split(trie,items) do
splitted_items = items |>String.split( "", trim: true)
|>Enum.map( fn(item)->
key = gen_unique_id
add_to_trie(trie, item)
end )
# final_item = add_relation(splitted_items, items)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment