Skip to content

Branches - Macaria#30

Open
mdove92 wants to merge 1 commit into
Ada-C12:masterfrom
mdove92:master
Open

Branches - Macaria#30
mdove92 wants to merge 1 commit into
Ada-C12:masterfrom
mdove92:master

Conversation

@mdove92

@mdove92 mdove92 commented Sep 9, 2019

Copy link
Copy Markdown

No description provided.

@CheezItMan CheezItMan left a comment

Copy link
Copy Markdown

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.

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

def reverse(array, length)

Copy link
Copy Markdown

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.

# Returns true if found, false otherwise.
# Time complexity: ?
# Space complexity: ?
# Time complexity: O(n)

Copy link
Copy Markdown

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