Created
June 17, 2017 02:25
-
-
Save glennlopez/ac096eb10bf7e7a226ba1b7ce9a4edb5 to your computer and use it in GitHub Desktop.
/r/cs50/comments/6hjd59/pset3_binary_search_help/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... //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