Open
Conversation
CheezItMan
reviewed
Nov 4, 2020
CheezItMan
left a comment
There was a problem hiding this comment.
Overall well done. Take a look at my comments and let me know what questions you have.
Comment on lines
+3
to
5
| # Time complexity: O(n) - it takes one recursion for every increase in n | ||
| # Space complexity: O(n) - because of the system stack | ||
| def factorial(n) |
Comment on lines
+12
to
15
| # Time complexity: O(n) - It takes n recursions for each character | ||
| # Space complexity: O(n^2) - n is number of characters | ||
| # String objects with length n * (n-1) * (n-2) ... are made | ||
| def reverse(s) |
There was a problem hiding this comment.
👍 , however your space/time complexity are both O(n^2)
Comment on lines
+21
to
23
| # Time complexity: O(n) - It will take n/2 swaps to reverse the string | ||
| # Space complexity: O(n) - For the system stack | ||
| def reverse_inplace(s) |
Comment on lines
+36
to
38
| # Time complexity: O(n) - one recursion for each bunny | ||
| # Space complexity: O(n) - system stack | ||
| def bunny(n) |
Comment on lines
+48
to
50
| # Time complexity: O(n) - has to look through each character | ||
| # Space complexity: O(n) - system stack | ||
| def nested(s) |
There was a problem hiding this comment.
This is working if the number of "(" and ")" match, but what about ")("?
Comment on lines
+66
to
68
| # Time complexity: O(n) - Linear search | ||
| # Space complexity: O(n) - system stack | ||
| def search(array, value) |
Comment on lines
+82
to
84
| # Time complexity: O(n) - n/2 recursions | ||
| # Space complexity: O(n) - system stack | ||
| def is_palindrome(s) |
Comment on lines
+100
to
103
| # Time complexity: O(logn) - Where n is the larger of n or m. | ||
| # Reduces n by a factor of 10 every recursion | ||
| # Space complexity: O(logn) - System stack | ||
| def digit_match(n, m) |
Comment on lines
+124
to
+126
| # Time complexity: O(n) - One recursion for every n | ||
| # Space compexlity: O(n) - System stack | ||
| def fib(n, f0 = 0, f1 = 1, index = 1) |
There was a problem hiding this comment.
Nice work on a tail recursive version of Fibonacci.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.