CODE NOT WORKING PROPERLY


It is not working properly for larger values of N say 7 or 9

code is correct but your input is incorrect

to apply binary search your array must be sorted

if you want to ask something about this feel free to ask
i hope this helps
if yes show your response with :heart: and don’t forgot to mark doubt as resolved

Hey now I have used the sort fucntion. Still not working. https://ide.codingblocks.com/s/314539

your input
8
2
5
8
8
8
8
10
12

in this input where is the key???
first you provide N size of array=8
then 8 elements
now you also have to provide the key

Oh okay. Thank you