Skip to content

Conversation

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

Overall nice work Jessica. I did find a small error in add_last. Otherwise quite well done.

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 +30 to 32
# 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 +46 to 48
# Time Complexity: O(n)
# Space Complexity: O(1)
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 +63 to 65
# 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 +82 to 84
# Time Complexity: O(1)
# Space Complexity: O(1)
def get_first

Choose a reason for hiding this comment

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

👍

Comment on lines +116 to 119
# Time Complexity: O(n)
# Space Complexity: O(1)

def get_at_index(index)

Choose a reason for hiding this comment

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

👍

Comment on lines +135 to 137
# Time Complexity: O(n)
# Space Complexity: O(1)
def visit

Choose a reason for hiding this comment

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

👍

Comment on lines +94 to +97
until current.nil?
current = current.next
end
current = Node.new(value)

Choose a reason for hiding this comment

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

This was not linking in the new node to the list.

Suggested change
until current.nil?
current = current.next
end
current = Node.new(value)
if @head.nil?
self.add_first(value)
end
until current.next.nil?
current = current.next
end
current.next = Node.new(value)

# returns nil if the linked list is empty
# 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.

👍

Comment on lines +149 to 152
# 0 1 2 nil
# 2

def delete(value)

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