Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upAdded 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 |
This comment has been minimized.
This comment has been minimized.
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
This comment has been minimized.
This comment has been minimized.
class trie: # use case: username/password | ||
def __init__(self): | ||
self.start = trienode('') | ||
def insert(self,id,data): # returns true on successful insertion (data == password) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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: |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
t.insert('test2',"dummy2") | ||
print(t.findNode('test')) # (false,None) | ||
a,b = t.findNode('test1') | ||
print(a,b) # (true,memref) |
This comment has been minimized.
This comment has been minimized.
0001vrn
Oct 28, 2019
Instead of printing a memref
use an appropriate message.
Refer to - https://www.geeksforgeeks.org/trie-insert-and-search/
This comment has been minimized.
This comment has been minimized.
0001vrn left a comment •
Minor comments. Going forward, kindly request you to use meaningful and appropriate variable names. Also, to understand the significance behind |
This comment has been minimized.
This comment has been minimized.
0001vrn
commented
Nov 24, 2019
@GajeshS |
This comment has been minimized.
This comment has been minimized.
Hey, |
This comment has been minimized.
This comment has been minimized.
0001vrn
commented
Dec 7, 2019
Please address all the review comments @GajeshS |
GajeshS commentedOct 26, 2019
#67 Added logic for Trie for use cases such as storing username/password.