Skip to content

Conversation

norrise120
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.

Nicely done, you hit the major learning goals here. Take a look at my comments and let me know if you have any questions.

# Time Complexity:
# Space Complexity
# Time Complexity: O(n), where n is the length of the list
# Space Complexity: ?? I'm not sure if puts counts as using memory. If it does, then O(n), where n is the length of the list. Otherwise O(1)

Choose a reason for hiding this comment

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

It doesn't, the output goes to the screen and is forgotten.

# Space Complexity: O(1)
def find_middle_value
raise NotImplementedError
return self.get_at_index(self.length / 2)

Choose a reason for hiding this comment

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

smart!

# Space Complexity: O(1)
def find_nth_from_end(n)
raise NotImplementedError
largest_index = self.length - 1

Choose a reason for hiding this comment

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

Why not use get_at_index again?

# Space Complexity: O(1)
def insert_ascending(value)
raise NotImplementedError
add_first(value) if @head == nil

Choose a reason for hiding this comment

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

This doesn't look right, you would end up inserting value into the list multiple times.

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