-
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
Sockets - Karla #24
base: master
Are you sure you want to change the base?
Sockets - Karla #24
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.
Well done! You hit all the learning goals here. Take a look at my comments and let me know if you have any questions.
# Space Complexity: O(1) | ||
def search(value) | ||
current_node = @head | ||
until current_node.data == 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.
What if @head
is nil
?
return true | ||
else | ||
current_node = current_node.next | ||
end |
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.
What do you return if you don't find it?
def find_middle_value | ||
index = self.length / 2 | ||
if index > -1 | ||
return self.get_at_index(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.
smart!
# Space Complexity | ||
def get_first | ||
raise NotImplementedError | ||
until move_by_two == nil && move_by_two.next == 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.
Shouldn't this be an or?
raise NotImplementedError | ||
# method that inserts a given value as a new last node in the linked list | ||
# Time Complexity: O(n) | ||
# 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.
space complexity?
raise NotImplementedError | ||
# method that returns the value of the last node in the linked list | ||
# returns nil if the linked list is empty | ||
# Time 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.
I think you understand the idea here, but I'm just noting the absence one last time.
No description provided.