Next up, let's implement add.

Step Four

A word is passed into the method (let's say "cat"), and begins to get processed. We'll first want to have references to the head node so that we can include each letter in cat as its eventual children and grandchildren. Here's how we accomplish establishing this lineage:

1# add key into trie if not present
2# else just marks the leaf node
3pCrawl = self.root
4length = len(key)
5for level in range(length):
6    index = self._charToIndex(key[level])