Trie implementation#111
Conversation
* Basic definition of Trie in comments at the top of the file * Defined Trie class and method signatures.
* Finished function to insert a word into Trie * Finished function to find a word in the Trie * Added Test functions with Assertions
| making it impractical in practice. It however provides O(max(search_string, length of longest word)) lookup | ||
| time making it an optimal approach when space is not an issue. | ||
|
|
||
| This implementation assumes the character $ is not in any of the words. This character is used in the implementation |
There was a problem hiding this comment.
Can you please find some way to achieve the desired result without setting a predefined character? An algorithm is supposed to consider all test cases in mind. Good job though!
There was a problem hiding this comment.
Thanks, no prob! I'll work on it
| def test(): | ||
| words = [] | ||
| # Load words from text file into Trie | ||
| with open("../../other/Dictionary.txt", "r") as ins: |
There was a problem hiding this comment.
Can you please switch this with a string sample? This would make it easier for the user to run and test the code. Thanks.
sachinarora707
left a comment
There was a problem hiding this comment.
Taking input from a file makes it difficult to test the algorithm. Please get input from user or else, add a sample input.
* No longer reading from file but instead provided simple sample input for easier testing
|
@sachinarora707 @r0hit-gupta I'm now using a boolean attribute instead of the $ and provided a list of strings instead of reading from the file |
|
@JavonDavis great job. Please delete the empty |
Regarding #105 I've worked on a Trie implementation using a dict