first draft of working methods and time/space guesses#38
first draft of working methods and time/space guesses#38RenCarothers wants to merge 1 commit intoAda-C14:masterfrom
Conversation
CheezItMan
left a comment
There was a problem hiding this comment.
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.
👍 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.
👍 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.
👍 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.
👍 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.
👍 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.
👍 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.
👍 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.