Skip to content

Conversation

@M-Burr
Copy link

@M-Burr M-Burr commented Nov 14, 2019

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.

Ok so you're missing some of the methods. The ones you have are working although you have some issues with time/space complexity. We'll go over things in class today. Let me know if you have questions.


# Time complexity: ?
# Space complexity: ?
def factorial(n)

Choose a reason for hiding this comment

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

👍 Missing Time/space complexity.

return s
end
a = s[0]
b = s.slice(1, s.length - 1)

Choose a reason for hiding this comment

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

s.slice creates a new array and copies all the individual elements over and so is O(n) by itself.

# Space complexity: ?
def reverse(s)
raise NotImplementedError, "Method not implemented"
def reverse(s)

Choose a reason for hiding this comment

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

👍
This works, but because you create a new array with each recursive call this is O(n2) for both time/space complexity.


# Time complexity: ?
# Space complexity: ?
def reverse_inplace(s)

Choose a reason for hiding this comment

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

Ok this this is missing


# Time complexity: ?
# Space complexity: ?
def bunny(n)

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