| |
Methods defined here:
- __init__(self)
- Initialize self. See help(type(self)) for accurate signature.
- __str__(self)
- Return str(self).
- add_node(self, word, path)
- O(n)
Method adds word in trie and properly increments counter for number of appearances
:param word: adding word
:param path: current file path
- print_words(self, root)
- Recursive method for printing all words from trie, starting from root
:param root: trie root
- word_exists(self, word)
- O(n)
Method checks if word exists in trie
:param word: the word whose existence method checks
:return: False if word isn't in trie or dict with file paths as keys and
numbers of appearances for that word on specific path
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- TrieNode = <class 'trie.Trie.TrieNode'>
|