Skip to content

Conversation

@kguadron
Copy link

No description provided.

Copy link

@CheezItMan CheezItMan left a 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

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

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)

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

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:

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:

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants