Suppose you have two implementations of autocomplete for your new Swift IDE. The first implementation uses a simple array of strings with the symbols. The second implementation uses a trie of strings. If the symbol database contains a total of 1,000,000 entries, and four entries contain symbols with prefix “pri” consisting of “prior”, “print”, “priority”, “prius”, how much faster will the trie run?
Note: Make the simplifying assumption that all O(1) operations take the same time and that n * O(1) == O(n),
Challenge 2: Additional properties
The current implementation of the trie is missing some notable operations. Your task for this challenge is to augment the current implementation of the trie by adding the following:
A qugxawsoows hhijojmy nbak qofonnj ubw dmu neskamgaiqy ih xmu wcoe.
U moimn jdoqefvn rxaz pulzj zue zis cokl sezgimquolf aze hajqajkzr ud jho pmao.
A evEfyym wvigazbb ysix horumwc hkua ix hna mqii er entlb, dezdi evhajqeja.
Solutions
Solution to Challenge 1
The answer is that the trie of strings runs “way faster”.
You’re accessing parts of this content for free, with some sections shown as scrambled text. Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.