Skip to content

Conversation

@sophearychiv
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.

Nice work! You hit the learning goals here, and did very well with the Big-O questions. Nice work. Take a look at my comments and let me know any questions you have.

def search(value)
raise NotImplementedError
return false if @head.nil?
return true if @head.data = value

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? Wouldn't the loop catch this as well?

return nil if @head.nil?
current = @head
index = 0
until current.nil?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if n is larger than the length of the list?

# Space Complexity: O(1)
def has_cycle
raise NotImplementedError
return nil if @head.nil?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

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