Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Earth - Sophie #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Earth - Sophie #20

wants to merge 2 commits into from

Conversation

steve-messing
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.

These methods look good Sophie. You hit the learning goals here. 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 +25 to +32
# if head is nil
return @head = Node.new(value) if @head.nil?

# if head contains data
new_node = Node.new(value)
new_node.next = @head
@head = new_node
return @head

Choose a reason for hiding this comment

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

Suggested change
# if head is nil
return @head = Node.new(value) if @head.nil?
# if head contains data
new_node = Node.new(value)
new_node.next = @head
@head = new_node
return @head
@head = Node.new(value, @head)

Comment on lines +37 to 39
# 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 +52 to 54
# 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 +73 to 75
# 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 +95 to 97
# 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 102 to 104
# Time Complexity: ?
# Space Complexity: ?
def add_last(value)

Choose a reason for hiding this comment

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

👍 Time complexity O(n) and space complexity O(1)

Comment on lines +119 to 121
# Time Complexity: o(n)
# Space Complexity: o(1)
def length

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 get_at_index(index)

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