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

Restricted Arrays - Mackenzie #27

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

Conversation

mvlofthus
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 Mackenzie, you hit the leaning goals here. Nice work.

Comment on lines +9 to 11
# Time complexity: O(n)
# Space complexity: O(1)
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 +23 to 25
# Time complexity: O(n)
# Space complexity: O(1)
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 +39 to 41
# Time complexity: O(n)
# Space complexity: O(1)
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 +59 to 61
# Time complexity: O(n)
# Space complexity: O(1)
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 +80 to 82
# Time complexity: O(n)
# Space complexity: O(1)
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 +103 to 105
# Time complexity: O(n)
# Space complexity: O(1)
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 +128 to 130
# Time complexity: O(log(n))
# Space complexity: O(n)
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.

👍

Comment on lines +149 to +151
if array[mid] != value_to_find
return false
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a little boolean zen

Suggested change
if array[mid] != value_to_find
return false
end
return array[mid] == value_to_find

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