Skip to content

Water - Jessica - #38

Open
jwinchan wants to merge 2 commits into
Ada-C14:masterfrom
jwinchan:master
Open

Water - Jessica#38
jwinchan wants to merge 2 commits into
Ada-C14:masterfrom
jwinchan:master

Conversation

@jwinchan

Copy link
Copy Markdown

No description provided.

@CheezItMan CheezItMan left a comment

Copy link
Copy Markdown

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 thread lib/linked_list.rb
Comment on lines +21 to 23
# Time Complexity: O(1)
# Space Complexity: O(1)
def add_first(value)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread lib/linked_list.rb
Comment on lines +30 to 32
# Time Complexity: O(n)
# Space Complexity: O(1)
def search(value)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread lib/linked_list.rb
Comment on lines +46 to 48
# Time Complexity: O(n)
# Space Complexity: O(1)
def find_max

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread lib/linked_list.rb
Comment on lines +63 to 65
# Time Complexity: O(n)
# Space Complexity: O(1)
def find_min

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread lib/linked_list.rb
Comment on lines +82 to 84
# Time Complexity: O(1)
# Space Complexity: O(1)
def get_first

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread lib/linked_list.rb
Comment on lines +116 to 119
# Time Complexity: O(n)
# Space Complexity: O(1)

def get_at_index(index)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread lib/linked_list.rb
Comment on lines +135 to 137
# Time Complexity: O(n)
# Space Complexity: O(1)
def visit

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

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

Copy link
Copy Markdown

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)

Comment thread lib/linked_list.rb
@@ -106,7 +177,11 @@ def reverse
# Time Complexity: ?
# Space Complexity: ?
def get_last

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread lib/linked_list.rb
Comment on lines +149 to 152
# 0 1 2 nil
# 2

def delete(value)

Copy link
Copy Markdown

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