Skip to content
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

Fire - Anna #28

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Fire - Anna #28

wants to merge 6 commits into from

Conversation

annakim93
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.

Well done Anna, you hit the learning goals here. Nice work!

Comment on lines +15 to 20
# Complexity assessment:
# Note: where n = length of the input array
# Time complexity: O(n); linear; at most will parse through each array elem once
# Space complexity: O(1); constant; excluding the input space,
# the variables included in the function are all constants
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.

👍

Comment on lines +41 to 45
# Complexity assessment:
# Note: where n = length of the input array
# Time complexity: O(n); linear; prints each elem of array
# Space complexity: O(1); constant; space for index (int)
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.

👍

Comment on lines +59 to 63
# Complexity assessment:
# Note: where n = length of the input array
# Time complexity: O(n); linear; worst case goes through array from beginning to end to find value
# Space complexity: O(1); constant; doesn't require more space than input array and index constant
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.

👍

Comment on lines +81 to 85
# Complexity assessment:
# Note: where n = length of the input array
# Time complexity: O(n); linear; worst case will parse through array from beginning to end to find max
# Space complexity: O(1); constant; does not require new vars aside from index (int) and max value (int)
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.

👍

Comment on lines +105 to 109
# Complexity assessment:
# Note: where n = length of the input array
# Time complexity: O(n); linear; worst case will parse through array from beginning to end to find min
# Space complexity: O(1); constant; does not require new vars aside from index (int) and min value (int)
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.

👍

Comment on lines +128 to 132
# Complexity assessment:
# Note: where n = length of the input array
# Time complexity: O(n); linear; traverse through half of array O(n/2) --> O(n)
# Space complexity: O(1); constant; does not require new vars aside from index (int) and reverse_ind (int)
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.

👍

Comment on lines +153 to 158
# Complexity assessment:
# Note: where n = length of the input array
# Time complexity: O(log n); logarithmic; half of array is eliminated with each search:
# doubling size of array only increases search count by 1
# Space complexity: O(1); constant; does not require new vars aside from begin_ind (int), end_ind (int), and midpoint (int)
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.

👍

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.

2 participants