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

Branches - Macaria #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Branches - Macaria #30

wants to merge 1 commit into from

Conversation

mdove92
Copy link

@mdove92 mdove92 commented Sep 9, 2019

No description provided.

Copy link

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

Nice work, a few things had issues, but take a look at my comments and let me know if you have questions.

# Space complexity: ?
# Time complexity: O(n)
# Space complexity: O(n)

def reverse(array, length)

Choose a reason for hiding this comment

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

This works, but you could do this "In place" without needing an external array.

Instead just swap the first and last elements, then the nest-first and next-to-last etc.

end

# For an array sorted in ascending order, searches for 'value_to_find'.
# Returns true if found, false otherwise.
# Time complexity: ?
# Space complexity: ?
# Time complexity: O(n)

Choose a reason for hiding this comment

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

Since you cut the number of elements to search with each iteration the time complexity is O(log n)

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