Skip to content

first draft of working methods and time/space guesses#38

Open
RenCarothers wants to merge 1 commit intoAda-C14:masterfrom
RenCarothers:master
Open

first draft of working methods and time/space guesses#38
RenCarothers wants to merge 1 commit intoAda-C14:masterfrom
RenCarothers:master

Conversation

@RenCarothers
Copy link

No description provided.

Copy link
Collaborator

@CheezItMan CheezItMan left a 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.

Comment on lines +11 to 14
# 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)
Copy link
Collaborator

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.

Comment on lines +32 to 34
# 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)
Copy link
Collaborator

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.

Comment on lines +53 to 55
# 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)
Copy link
Collaborator

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.

Comment on lines +81 to 83
# 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)
Copy link
Collaborator

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.

Comment on lines +109 to 111
# 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)
Copy link
Collaborator

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.

Comment on lines +137 to 139
# 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)
Copy link
Collaborator

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.

Comment on lines +167 to 169
# Time complexity: O(logn)
# Space complexity: O(logn)
def binary_search(array, length, value_to_find)
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants