Skip to content

Instantly share code, notes, and snippets.

@glennlopez
Created June 17, 2017 02:25
Show Gist options
  • Save glennlopez/ac096eb10bf7e7a226ba1b7ce9a4edb5 to your computer and use it in GitHub Desktop.
Save glennlopez/ac096eb10bf7e7a226ba1b7ce9a4edb5 to your computer and use it in GitHub Desktop.
/r/cs50/comments/6hjd59/pset3_binary_search_help/
... //more code above this line
if(startPoint > endPoint){ //<-- startpoint is now larger than end point so I "break;" from the loop
break; //<-- prevents infinit loop
}
while(values[midPoint] != value); //<--- my sorting loop ends when it finds
//return results
if(startPoint > endPoint){ //<-- I know its false becuase startpoint is now larger than endpoint
return false; //<-- so I return a false
}
else{
return true; //<-- im assuming midpoint value "is equal" (==) to value since its no longer looping
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment