Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Trie Logic #86

Open
wants to merge 1 commit into
base: master
from

Conversation

@GajeshS
Copy link

GajeshS commented Oct 26, 2019

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

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.

Copy link
@0001vrn

This comment has been minimized.

Copy link
@GajeshS

GajeshS Dec 7, 2019

Author

Updated the variable name.

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.

Copy link
@0001vrn

0001vrn Oct 28, 2019

Please use key instead of data as a variable name.

This comment has been minimized.

Copy link
@GajeshS

GajeshS Dec 7, 2019

Author

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:

This comment has been minimized.

Copy link
@0001vrn

0001vrn Oct 28, 2019

Please use appropriate variable name for variable x

This comment has been minimized.

Copy link
@GajeshS
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.

Copy link
@0001vrn

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.

Copy link
@GajeshS
Copy link

0001vrn left a comment

Minor comments. Going forward, kindly request you to use meaningful and appropriate variable names.

Also, to understand the significance behind meaningful names
Please read chapter 2 of the book - Clean Code
Refer to https://github.com/SaikrishnaReddy1919/MyBooks/blob/master/%5BPROGRAMMING%5D%5BClean%20Code%20by%20Robert%20C%20Martin%5D.pdf

@0001vrn

This comment has been minimized.

Copy link

0001vrn commented Nov 24, 2019

@GajeshS
Would you be able to incorporate the code review comments?

@GajeshS GajeshS force-pushed the GajeshS:master branch from 3c7f36f to 545e6cb Dec 4, 2019
@GajeshS

This comment has been minimized.

Copy link
Author

GajeshS commented Dec 4, 2019

Hey,
Sorry for the late reply. Made the changes in the new patch.

@0001vrn

This comment has been minimized.

Copy link

0001vrn commented Dec 7, 2019

Hey,
Sorry for the late reply. Made the changes in the new patch.

Please address all the review comments @GajeshS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.