Rock - N.Lucuab#63
Open
NLucuab wants to merge 1 commit intoAda-C15:masterfrom
Open
Conversation
CheezItMan
reviewed
Jan 26, 2022
CheezItMan
left a comment
There was a problem hiding this comment.
Nice work Nyckolle, you hit the learning goals here. Well done.
Comment on lines
+16
to
18
| # Time Complexity: O(1) | ||
| # Space Complexity: O(1) - nothing new is being added, so memory is unaffected | ||
| def get_first(self): |
Comment on lines
+28
to
30
| # Time Complexity: O(1) | ||
| # Space Complexity: O(1)? Only 1 node is being added, so 0(1) sounds right memory-wise | ||
| def add_first(self, value): |
Comment on lines
+35
to
37
| # Time Complexity: O(n) - traverses the whole list | ||
| # Space Complexity: O(1) - nothing new is being added, so memory is unaffected | ||
| def search(self, value): |
Comment on lines
+47
to
49
| # Time Complexity: O(n) - traverses the list | ||
| # Space Complexity: O(1) - no new node is being added, so memory is unaffected | ||
| def length(self): |
Comment on lines
+64
to
66
| # Time Complexity: O(n) - traverses the list to find value | ||
| # Space Complexity: O(1) - no new node is being added, so memory is unaffected | ||
| def get_at_index(self, index): |
Comment on lines
+98
to
100
| # Time Complexity: O(1) - only inserts 1 value | ||
| # Space Complexity: O(n) - traverses the list in order to find the end, and then adds on value | ||
| def add_last(self, value): |
There was a problem hiding this comment.
👍 The time complexity is O(n) because you traverse to the end of the list. The space complexity is O(1) because you only ever add one node.
|
|
||
| # method to return the max value in the linked list | ||
| # returns the data value and not the node | ||
| def find_max(self): |
Comment on lines
+133
to
135
| # Time Complexity: O(n) - traverses list to find specified value | ||
| # Space Complexity: O(1) - deletes only 1 value | ||
| def delete(self, value): |
Comment on lines
+165
to
+166
| # Time Complexity: O(n) - traverses list | ||
| # Space Complexity: O(n) - prints out every value |
Comment on lines
+179
to
181
| # Time Complexity: O(n) - traverses/reverses entire list | ||
| # Space Complexity: O(1) - no new nodes are being added | ||
| def reverse(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked List project - passes all 27 required tests