Multiway Tries

functions:

  • insert: simply attempt to follow the find algorithm. If, at any point, the edge we need to traverse does not exist, simply create the edge (and node to which it should point), and continue.
  • remove: Traverse the word you are going to remove, and remove word node label.
  • find: Traverse the word you are finding. If finally reach word node, the word is found.

Noted:

  • letters label edges of the trie, not nodes!
  • note that an "empty" Multiway Trie (i.e., a Multiway Trie with no keys) is a single-node tree with no edges.

  • Multiway Tries are extremely inefficient in terms of space usage

REFERENCES: Stepik 6.6

results matching ""

    No results matching ""