-
Notifications
You must be signed in to change notification settings - Fork 47
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
Savannah #20
base: master
Are you sure you want to change the base?
Savannah #20
Conversation
… data, adds @Length instance var to ll class
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.
Excellent work, you hit all the learning goals here! Well done! Check out my comments and let me know if you have any questions.
@@ -14,136 +14,284 @@ def initialize(value, next_node = nil) | |||
class LinkedList | |||
def initialize | |||
@head = nil # keep the head private. Not accessible outside this class | |||
@tail = nil |
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.
Smart!
|
||
# method to return a string of all the values in the linked list | ||
# Time Complexity: O(n) where n is the number of nodes | ||
# 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.
Since you're building a string of equal size to the list, you have a space complexity of O(n)
No description provided.