Open
Conversation
CheezItMan
reviewed
Nov 4, 2020
CheezItMan
left a comment
There was a problem hiding this comment.
Nice work Gessica, you hit the learning goals here. Well done.
| @@ -0,0 +1,6 @@ | |||
| # Default ignored files | |||
There was a problem hiding this comment.
I suggest you add .idea to your .gitignore or .gitignore_global files.
Comment on lines
+3
to
5
| # Time complexity: O(n) it depends on the size of n to run | ||
| # Space complexity: O(n) it creates a stack every time it calls the recursive method | ||
| def factorial(n) |
Comment on lines
+12
to
14
| # Time complexity: O(n^2) - the slice method in the reverse method creates another array so that counts for O(n) and then the method runs n times depending on the size of array, O(n). Total of O(n^2). | ||
| # Space complexity: O(n^2) - because we are creating a new array when using the slice method and it creates a stack to run the recursion method. | ||
| def reverse(s) |
Comment on lines
+23
to
+25
| # Time complexity: O(n) it depends on the size of s to run | ||
| # Space complexity: O(n) it creates a stack every time if calls the recursive method | ||
| def reverse_inplace(s, i = 0, j = s.length - 1) |
Comment on lines
+36
to
38
| # Time complexity: O(n) it depends on the size of n to run | ||
| # Space complexity: O(n) it creates a stack every time if calls the recursive method | ||
| def bunny(n) |
Comment on lines
+43
to
+45
| # Time complexity: O(n) it depends on the size of s to run | ||
| # Space complexity: O(n) it creates a stack every time if calls the recursive method | ||
| def nested(s, i = 0, j = s.length - 1) |
Comment on lines
+52
to
+54
| # Time complexity: O(n) it depends on the size of the array to run | ||
| # Space complexity: O(n) it creates a stack every time if calls the recursive method | ||
| def search(array, value, index = 0) |
Comment on lines
+60
to
+62
| # Time complexity: O(n) it depends on the size of s to run | ||
| # Space complexity: O(n) it creates a stack every time if calls the recursive method | ||
| def is_palindrome(s, i = 0, j = s.length - 1) |
Comment on lines
+69
to
71
| # Time complexity: O(log n) | ||
| # Space complexity: O(log n) | ||
| def digit_match(n, m) |
Comment on lines
+85
to
+87
| # Time complexity: O(2^n) it depends on the size of n to run | ||
| # Space complexity: O(2^n) it creates a stack every time if calls the recursive method | ||
| def fibonacci(n) |
There was a problem hiding this comment.
👍 However the space complexity is O(n)
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.