Skip to content

Al Leonard - Linked List #48

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

Alli-Oops
Copy link

Thanks for looking at my Linked List answers!

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Al, overall nice work you hit the learning goals here, except you never tried working out the time/space complexity. I do suggest you try that as it's good practice.

Otherwise I only made some suggestions for drying up the code a bit. Let me know if you have questions.

Comment on lines +40 to +48
if current == None:
return False
while current:
if current.value == value:
return True
current = current.next
notTrue = True
if notTrue == True:
return False

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be simplified

Suggested change
if current == None:
return False
while current:
if current.value == value:
return True
current = current.next
notTrue = True
if notTrue == True:
return False
if current == None:
return False
while current:
if current.value == value:
return True
current = current.next
return False

Comment on lines +65 to +66
if node_count:
return node_count

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if node_count:
return node_count
return node_count

@@ -9,67 +9,149 @@ def __init__(self, value, next_node = None):
# Defines the singly linked list
class LinkedList:
def __init__(self):
self.head = None # keep the head private. Not accessible outside this class
self.head = None # keep the head private. Not accessible outside this class
self.tail = None # keep track of the tail

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice you're not using this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants