What is the function of 'bsearch' in this binary search program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the function of 'bsearch' in this binary search program?

https://code.sololearn.com/ch9TiB2oCW25/?ref=app i can't write it here

27th Nov 2018, 3:07 PM
yasifa ana
3 Answers
+ 8
bsearch is a boolean type variable which is used to exit the loop if the number in the array is found. Initially bsearch is set to false. If the number is present in the array, bsearch will become true and when the condition will be checked it will not satisfy, so it will get out of the loop. If number is not found then the bsearch will remain false
27th Nov 2018, 7:31 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 4
It's being used as a boolean variable.It's initially false and is being set to true if the element is found in the array.
27th Nov 2018, 3:11 PM
xyz$
0
Gellert , can you explain it again please? i dont get the point:'
27th Nov 2018, 3:22 PM
yasifa ana