-
Notifications
You must be signed in to change notification settings - Fork 87
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
Ruiz #73
base: master
Are you sure you want to change the base?
Ruiz #73
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨ Nice work, Juliana. I gave you some pointers on delete
since it seems like you ran into a bit of trouble there, and left some comments on Big O, but overall you have a great implementation. Let me know what questions you have.
🟢
# Time Complexity: ? | ||
# Space Complexity: ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⏱🪐 Time and space complexity?
# Time Complexity: ? | ||
# Space Complexity: ? | ||
# Time Complexity: o(1) | ||
# Space Complexity: o(1) | ||
def add_first(self, value): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
# Time Complexity: ? | ||
# Space Complexity: ? | ||
# Time Complexity: o(n) | ||
# Space Complexity: o(1) | ||
def search(self, value): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
# Time Complexity: ? | ||
# Space Complexity: ? | ||
# Time Complexity: O(n) | ||
# Space Complexity: O(1) | ||
def length(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
# Time Complexity: ? | ||
# Space Complexity: ? | ||
# Time Complexity: O(n) | ||
# Space Complexity: o(1) | ||
def get_at_index(self, index): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
current = self.head | ||
while current.next: | ||
current = current.next | ||
current.next = new_node | ||
|
||
# method to return the max value in the linked list | ||
# returns the data value and not the node | ||
def find_max(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
# current = self.head | ||
elif current.value == value: | ||
self.head = current.next | ||
return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to return a value here
return True | |
return | |
# current = self.head | ||
elif current.value == value: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now you are referencing current
before it exists
# current = self.head | |
elif current.value == value: | |
current = self.head | |
if current.value == value: | |
# Time Complexity: ? | ||
# Space Complexity: ? | ||
# Time Complexity: o(n) | ||
# Space Complexity: o(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🪐 Space complexity will be O(n) here since you are creating the list helper_list
which will end up holding all of the nodes in the linked list
# Time Complexity: ? | ||
# Space Complexity: ? | ||
# Time Complexity: O(n) | ||
# Space Complexity: O(1) | ||
def reverse(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨ Nice work, Juliana. I gave you some pointers on delete
since it seems like you ran into a bit of trouble there, and left some comments on Big O, but overall you have a great implementation. Let me know what questions you have.
🟢
No description provided.