-
Notifications
You must be signed in to change notification settings - Fork 49
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
Branches - C. Gutierrez #28
base: master
Are you sure you want to change the base?
Conversation
…ts re. space and time complexities
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.
Overall not bad. Check out my comments. I'm uncertain why you had the 21.times loops in your code. That puzzled me. You also had some issues with Big-O. Check out my comments and let me know if you have questions.
raise NotImplementedError | ||
i = 0 | ||
length = 0 | ||
21.times do |
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.
You don't need this 21.times
loop.
def print_array(array) | ||
raise NotImplementedError | ||
21.times do |
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.
Again you don't need this loop.
end | ||
|
||
# Reverses the values in the integer array in place | ||
# Time complexity: ? | ||
# Space complexity: ? | ||
# Time complexity: quadratic, the array is iterated through twice, so as it gorws, the time required to process it would grow twice as much. |
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.
Since the loops are not nested, and each loop runs n times. The time complexity is O(n)
No description provided.