Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd prefix-matching function to trie.py #1894
Conversation
| lst=[] | ||
| l= depth_first_search(sub_trie, '', prefix, lst) | ||
| return l | ||
| print_words(sub_trie, prefix) |
This comment has been minimized.
This comment has been minimized.
cclauss
Apr 20, 2020
Member
Algorithm functions should not print(). Please return the results to the caller.
This comment has been minimized.
This comment has been minimized.
| @@ -89,9 +92,7 @@ def depth_first_search(root: TrieNode, s: str, prefix: str, lst): | |||
| if sub_trie==False: | |||
| return False | |||
This comment has been minimized.
This comment has been minimized.
|
@cclauss Hey can you look at my changes once again. The code is building and passing pytests but it is still failing Travis Cl and codespell tests. Thank you. |
|
Codespell says ./data_structures/trie/trie.py:84: resturns ==> returns Travis says >>> get_words_starting_with("a") |
| @@ -55,7 +55,7 @@ def get_words_starting_with(self, prefix: str) -> [str]: | |||
| :param prefix: the prefix to be matched | |||
This comment has been minimized.
This comment has been minimized.
|
codespell errors |
|
|
||
| def depth_first_search(node: TrieNode, word: str, lst): | ||
| """ | ||
| resturns a list of all the nodes in a trie |
This comment has been minimized.
This comment has been minimized.
mrmaxguns
May 7, 2020
Contributor
Line 84 is causing codespell tests to fail. Easy typo resturns to returns
|
On line 38 can you please rename |
tasbihaasim commentedApr 19, 2020
•
edited
Added a new function match to trie.py. This function takes a prefix as an argument, traces that prefix in a trie and then iterates through all the succeeding letters in the sub-trie such that a list of words containing that prefix is returned.
Checklist:
Fixes: #{$ISSUE_NO}.