Skip to content

Conversation

@geli-gel
Copy link

@geli-gel geli-gel 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! You hit all the learning goals here. Do take a look at my comment on the time complexity of binary search. Well done.

# Returns true if found, false otherwise.
# Time complexity: ?
# Space complexity: ?
def search(array, length, value_to_find)

Choose a reason for hiding this comment

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

Big-O?

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

Choose a reason for hiding this comment

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

Since we cut the items to search in half with each iteration and we never have to progress through each element.

So this is O(log n) and not O(n 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