Conversation
kyra-patton
left a comment
There was a problem hiding this comment.
✨ 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: ? |
| # Space Complexity: ? | ||
| # Time Complexity: o(1) | ||
| # Space Complexity: o(1) | ||
| def add_first(self, value): |
| # Space Complexity: ? | ||
| # Time Complexity: o(n) | ||
| # Space Complexity: o(1) | ||
| def search(self, value): |
| # Space Complexity: ? | ||
| # Time Complexity: O(n) | ||
| # Space Complexity: O(1) | ||
| def length(self): |
| # Space Complexity: ? | ||
| # Time Complexity: O(n) | ||
| # Space Complexity: o(1) | ||
| def get_at_index(self, index): |
|
|
||
| # method to return the max value in the linked list | ||
| # returns the data value and not the node | ||
| def find_max(self): |
| # current = self.head | ||
| elif current.value == value: | ||
| self.head = current.next | ||
| return True |
There was a problem hiding this comment.
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.
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.
🪐 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
| # Space Complexity: ? | ||
| # Time Complexity: O(n) | ||
| # Space Complexity: O(1) | ||
| def reverse(self): |
kyra-patton
left a comment
There was a problem hiding this comment.
✨ 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.