Skip to content

Conversation

@kashenafi
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 Kal, you hit the learning goals here. Well done. I had some feedback, take a look and let me know what questions you have.

raise NotImplementedError
length = self.length

return nil if index > length

Choose a reason for hiding this comment

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

This would fix the failing test

Suggested change
return nil if index > length
return nil if index >= length

Comment on lines +21 to 23
# Time Complexity: O(1)
# Space Complexity: O(1)
def add_first(value)

Choose a reason for hiding this comment

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

👍

Comment on lines +29 to 31
# Time Complexity: O(n)
# Space Complexity: O(1)
def search(value)

Choose a reason for hiding this comment

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

👍

Comment on lines 42 to 44
# method to return the max value in the linked list
# returns the data value and not the node
def find_max

Choose a reason for hiding this comment

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

👍

Comment on lines +61 to 63
# Time Complexity: O(n)
# Space Complexity: O(1)
def find_min

Choose a reason for hiding this comment

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

👍

Comment on lines +179 to 181
# Time Complexity: O(n)
# Space Complexity: O(1)
def reverse

Choose a reason for hiding this comment

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

👍 Nicely done

Comment on lines 199 to 201
# Time Complexity: ?
# Space Complexity: ?
def get_last

Choose a reason for hiding this comment

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

👍 , I assume now you know the time/space complexity

Comment on lines 222 to 224
# Time Complexity: ?
# Space Complexity: ?
def find_nth_from_end(n)

Choose a reason for hiding this comment

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

👍

# returns true if a cycle is found, false otherwise.
# Time Complexity: ?
# Space Complexity: ?
def has_cycle

Choose a reason for hiding this comment

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

👍

Comment on lines +268 to +270
return nil if @head.nil?

current_node = @head

Choose a reason for hiding this comment

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

I think here you'll need to check if head is nil, then insert first.

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