Linked List project finished passing 27 tests#60
Open
ktiktok96 wants to merge 1 commit intoAda-C15:masterfrom
Open
Linked List project finished passing 27 tests#60ktiktok96 wants to merge 1 commit intoAda-C15:masterfrom
ktiktok96 wants to merge 1 commit intoAda-C15:masterfrom
Conversation
CheezItMan
reviewed
Jan 21, 2022
CheezItMan
left a comment
There was a problem hiding this comment.
Nice work Karla, thanks for getting this in. If you can in future submissions try to answer the time/space complexity questions.
Comment on lines
17
to
21
| # returns the value in the first node | ||
| # returns None if the list is empty | ||
| # Time Complexity: ? | ||
| # Space Complexity: ? | ||
| def get_first(self): |
Comment on lines
31
to
33
| # Time Complexity: ? | ||
| # Space Complexity: ? | ||
| def add_first(self, value): |
Comment on lines
41
to
43
| # Time Complexity: ? | ||
| # Space Complexity: ? | ||
| def search(self, value): |
Comment on lines
53
to
55
| # Time Complexity: ? | ||
| # Space Complexity: ? | ||
| def length(self): |
Comment on lines
67
to
69
| # Time Complexity: ? | ||
| # Space Complexity: ? | ||
| def get_at_index(self, index): |
Comment on lines
95
to
97
| # Time Complexity: ? | ||
| # Space Complexity: ? | ||
| def add_last(self, value): |
|
|
||
| # method to return the max value in the linked list | ||
| # returns the data value and not the node | ||
| def find_max(self): |
| self.head = self.head.next | ||
| return | ||
| while current != None: | ||
| next = current |
There was a problem hiding this comment.
Maybe previous would be a better variable name?
Comment on lines
122
to
124
| # Time Complexity: ? | ||
| # Space Complexity: ? | ||
| def delete(self, value): |
Comment on lines
158
to
160
| # Time Complexity: ? | ||
| # Space Complexity: ? | ||
| def reverse(self): |
Author
|
Absolutely no problem at all.
…On Fri, Jan 21, 2022, 11:23 AM Chris M ***@***.***> wrote:
***@***.**** commented on this pull request.
Nice work Karla, thanks for getting this in. If you can in future
submissions try to answer the time/space complexity questions.
------------------------------
In linked_list/linked_list.py
<#60 (comment)>:
> # returns the value in the first node
# returns None if the list is empty
# Time Complexity: ?
# Space Complexity: ?
def get_first(self):
👍 Time/space complexity?
------------------------------
In linked_list/linked_list.py
<#60 (comment)>:
> # Time Complexity: ?
# Space Complexity: ?
def add_first(self, value):
👍 Time/space complexity?
------------------------------
In linked_list/linked_list.py
<#60 (comment)>:
> # Time Complexity: ?
# Space Complexity: ?
def search(self, value):
👍 Time/space complexity?
------------------------------
In linked_list/linked_list.py
<#60 (comment)>:
> # Time Complexity: ?
# Space Complexity: ?
def length(self):
👍 Time/space complexity?
------------------------------
In linked_list/linked_list.py
<#60 (comment)>:
> # Time Complexity: ?
# Space Complexity: ?
def get_at_index(self, index):
👍 Time/space complexity?
------------------------------
In linked_list/linked_list.py
<#60 (comment)>:
> # Time Complexity: ?
# Space Complexity: ?
def get_last(self):
👍 Time/space complexity?
------------------------------
In linked_list/linked_list.py
<#60 (comment)>:
> # Time Complexity: ?
# Space Complexity: ?
def add_last(self, value):
👍 Time/space complexity?
------------------------------
In linked_list/linked_list.py
<#60 (comment)>:
>
# method that inserts a given value as a new last node in the linked list
# Time Complexity: ?
# Space Complexity: ?
def add_last(self, value):
- pass
+ new_node = Node(value)
+ current = self.head
+ if current == None:
+ self.head = new_node
+ return
+ while current.next != None:
+ 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):
👍
------------------------------
In linked_list/linked_list.py
<#60 (comment)>:
>
# method to delete the first node found with specified value
# Time Complexity: ?
# Space Complexity: ?
def delete(self, value):
- pass
+ current = self.head
+ current_value = 0
+ if current == None:
+ return
+ if current.value == value:
+ self.head = self.head.next
+ return
+ while current != None:
+ next = current
Maybe previous would be a better variable name?
------------------------------
In linked_list/linked_list.py
<#60 (comment)>:
> # Time Complexity: ?
# Space Complexity: ?
def delete(self, value):
👍 Time/space complexity?
------------------------------
In linked_list/linked_list.py
<#60 (comment)>:
> # Time Complexity: ?
# Space Complexity: ?
def reverse(self):
👍 Time/space complexity?
—
Reply to this email directly, view it on GitHub
<#60 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQYXXKPCWY2KULFLAOZKMN3UXGB7PANCNFSM5MOIXZ2Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
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.
No description provided.