-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Pseudo Code Binary Search lesson: v > m #16
Comments
@prb01 if the needle (n) is ahead of the middle value (m) then low should be mid + 1. there's some mess up in the sudo code....ignore that. if (value === needle) {
return true;
} else if (needle > value) {
low = mid + 1;
} else {
high = mid;
} |
@prb01 In addition, I recently noticed that he had set the initial value for hi as array.length. I've been looking for some good refreshers on algorithms lately, and I was always under the impression that it should be array.length - 1? Does that not matter? -James |
@jameszenartist I know this is over a year old, but I have an answer 🤣
|
Hi @Agent-E11 , thank you for your reply! Yes, that does make sense! -James |
Not sure if this is the right place to raise this but FrontendMasters suggested raising an issue in the repo.
In the Pseudo Code Binary Search lesson, shouldn't the
else if
condition specifyn > v
rather thanv > m
, wheren = needle
,v = value at midpoint
,m = midpoint
?Thanks!
The text was updated successfully, but these errors were encountered: