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 upAdded Trie Logic #86
Added Trie Logic #86
Conversation
| def __init__(self): | ||
| self.start = trienode('') | ||
| def insert(self,id,data): # returns true on successful insertion (data == password) | ||
| temp = self.start |
0001vrn
Oct 28, 2019
Please use an appropriate variable name for temp
Refer to - https://www.quora.com/Why-is-using-a-variable-name-temp-considered-bad-practice
Please use an appropriate variable name for temp
Refer to - https://www.quora.com/Why-is-using-a-variable-name-temp-considered-bad-practice
GajeshS
Dec 7, 2019
Author
Contributor
Updated the variable name.
Updated the variable name.
0001vrn
Dec 14, 2019
The variable name is still temp. Please change it to something meaningful @GajeshS
The variable name is still temp. Please change it to something meaningful @GajeshS
| class trie: # use case: username/password | ||
| def __init__(self): | ||
| self.start = trienode('') | ||
| def insert(self,id,data): # returns true on successful insertion (data == password) |
0001vrn
Oct 28, 2019
Please use key instead of data as a variable name.
Please use key instead of data as a variable name.
GajeshS
Dec 7, 2019
Author
Contributor
Updated the variable name
Updated the variable name
| return True | ||
| def findNode(self,id): # returns false if node doesn't exist and true, node if it does | ||
| temp = self.start | ||
| for x in id: |
0001vrn
Oct 28, 2019
•
Please use appropriate variable name for variable x
Please use appropriate variable name for variable x
GajeshS
Dec 7, 2019
Author
Contributor
Done
Done
| t.insert('test2',"dummy2") | ||
| print(t.findNode('test')) # (false,None) | ||
| a,b = t.findNode('test1') | ||
| print(a,b) # (true,memref) |
0001vrn
Oct 28, 2019
Instead of printing a memref use an appropriate message.
Refer to - https://www.geeksforgeeks.org/trie-insert-and-search/
Instead of printing a memref use an appropriate message.
Refer to - https://www.geeksforgeeks.org/trie-insert-and-search/
GajeshS
Dec 7, 2019
Author
Contributor
Done
Done
|
Minor comments. Going forward, kindly request you to use meaningful and appropriate variable names. Also, to understand the significance behind |
|
@GajeshS |
|
Hey, |
Please address all the review comments @GajeshS |
| def __init__(self): | ||
| self.start = trienode('') | ||
| def insert(self,id,data): # returns true on successful insertion (data == password) | ||
| temp = self.start |
0001vrn
Dec 14, 2019
The variable name is still temp. Please change it to something meaningful @GajeshS
The variable name is still temp. Please change it to something meaningful @GajeshS
|
Rename temp |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

#67 Added logic for Trie for use cases such as storing username/password.