The Wayback Machine - https://web.archive.org/web/20201009231231/https://github.com/AllAlgorithms/python/pull/86
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

Merged
merged 1 commit into from Oct 3, 2020
Merged

Added Trie Logic #86

merged 1 commit into from Oct 3, 2020

Conversation

@GajeshS
Copy link
Contributor

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

This comment has been minimized.

@GajeshS

GajeshS Dec 7, 2019
Author Contributor

Updated the variable name.

This comment has been minimized.

@0001vrn

0001vrn Dec 14, 2019

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)

This comment has been minimized.

@0001vrn

0001vrn Oct 28, 2019

Please use key instead of data as a variable name.

This comment has been minimized.

@GajeshS

GajeshS Dec 7, 2019
Author Contributor

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.

@0001vrn

0001vrn Oct 28, 2019

Please use appropriate variable name for variable x

This comment has been minimized.

@GajeshS

GajeshS Dec 7, 2019
Author Contributor

Done

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.

@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.

@GajeshS

GajeshS Dec 7, 2019
Author Contributor

Done

Copy link

@0001vrn 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
Copy link

@0001vrn 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
Copy link
Contributor Author

@GajeshS GajeshS commented Dec 4, 2019

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

@0001vrn
Copy link

@0001vrn 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

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.

@0001vrn

0001vrn Dec 14, 2019

The variable name is still temp. Please change it to something meaningful @GajeshS

Copy link

@adhithya-srinivasan adhithya-srinivasan left a comment

Rename temp

@abranhe abranhe merged commit bcf7e28 into AllAlgorithms:master Oct 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.