-
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
first draft of working methods and time/space guesses #38
base: master
Are you sure you want to change the base?
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.
Overall nice work Ren, you hit the essential learning goals. I do think you should pay close attention on Big O especially space complexity on this Wednesday's lesson.
# Time complexity: O(n); requires n steps or n operations where n is the length of the array | ||
# Space complexity: O(n); requires n steps or n operations where n is the length of the array | ||
|
||
def length(array) |
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 your space complexity is O(1) since you are not building any other data structure. Your method doesn't increase in memory usage if the input is bigger.
# Time complexity: O(n); requires n steps or n operations where n is the length of the array | ||
# Space complexity: O(n); requires n steps or n operations where n is the length of the array | ||
def print_array(array) |
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 your space complexity is O(1) since you are not building any other data structure. Your method doesn't increase in memory usage if the input is bigger.
# Time complexity: O(n); requires n steps or n operations where n is the length of the array | ||
# Space complexity: O(n); requires n steps or n operations where n is the length of the array | ||
def search(array, length, value_to_find) |
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 your space complexity is O(1) since you are not building any other data structure. Your method doesn't increase in memory usage if the input is bigger.
# Time complexity: O(n); requires n steps or n operations where n is the length of the array | ||
# Space complexity: O(n); requires n steps or n operations where n is the length of the array | ||
def find_largest(array, length) |
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 your space complexity is O(1) since you are not building any other data structure. Your method doesn't increase in memory usage if the input is bigger.
# Time complexity: O(n); requires n steps or n operations where n is the length of the array | ||
# Space complexity: O(n); requires n steps or n operations where n is the length of the array | ||
def find_smallest(array, length) |
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 your space complexity is O(1) since you are not building any other data structure. Your method doesn't increase in memory usage if the input is bigger.
# Time complexity: O(n); requires n steps or n operations where n is the length of the array | ||
# Space complexity: O(n); requires n steps or n operations where n is the length of the array | ||
def reverse(array, length) |
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 your space complexity is O(1) since you are not building any other data structure. Your method doesn't increase in memory usage if the input is bigger.
# Time complexity: O(logn) | ||
# Space complexity: O(logn) | ||
def binary_search(array, length, value_to_find) |
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 your space complexity is O(1) since you are not building any other data structure. Your method doesn't increase in memory usage if the input is bigger.
No description provided.