-
Notifications
You must be signed in to change notification settings - Fork 49
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-Steph #48
base: master
Are you sure you want to change the base?
Branches-Steph #48
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm glad you got this in. A few minor mistakes in a few of the methods here. Take a look at my suggestions and let me know if you have questions.
def binary_search(array, length, value_to_find) | ||
raise NotImplementedError | ||
bigger = array.length - 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In restricted Array, length is not a method. It's a parameter passed in.
bigger = array.length - 1 | |
bigger = length - 1 |
bigger = array.length - 1 | ||
smaller = 0 | ||
while bigger >= smaller | ||
middle = (high + low) / 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to define high and low here before the loop starts. Maybe use smaller and bigger.
middle = (high + low) / 2 | |
middle = (bigger + smaller) / 2 |
while i < length | ||
if array[i] < smallest | ||
smallest = array[i] | ||
i += 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't want to do this twice in the while loop.
i += 1 |
No description provided.