-
Notifications
You must be signed in to change notification settings - Fork 53
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 - Emily #31
base: master
Are you sure you want to change the base?
Earth - Emily #31
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work Emily, you hit the learning goals here. Well done. I do suggest you look at my suggestions and see if you can see ways to convert the methods into O(n) time/space complexity.
# Time complexity: O(n), where n is the length | ||
# Space complexity: O(n), uses up some space in the call stack until it reaches the base case | ||
def factorial(n) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
# Time complexity: O(n^2) | ||
# Space complexity: O(n^2) | ||
def reverse(s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
# Time complexity: O(n) | ||
# Space complexity: O(n) | ||
def reverse_inplace(s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
# Time complexity: O(n) | ||
# Space complexity: O(n) | ||
def bunny(n) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
# Time complexity: O(n^2) | ||
# Space complexity: O(n^2) | ||
def nested(s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 However can you see a way, like with reverse_inplace to do it with O(n) time/space complexity?
# Time complexity: O(n^2) | ||
# Space complexity: O(n^2) | ||
def search(array, value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 However can you see a way, like with reverse_inplace to do it with O(n) time/space complexity?
# Time complexity: O(n^2) | ||
# Space complexity: O(n^2) | ||
def is_palindrome(s) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 However can you see a way, like with reverse_inplace to do it with O(n) time/space complexity?
# Time complexity: O(n^2)? | ||
# Space complexity: O(n^2)? | ||
def digit_match(n, m) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 However can you see a way, like with reverse_inplace to do it with O(n) time/space complexity?
No description provided.