Peak element in binary search

code : https://ide.codingblocks.com/s/241068

can anyone tell me the error… where i am going wrong?


refer this video

thanks for this video

my this ques is little different… here i have to find peak element only instead of searching.


here is the code
if u have difficulty understanding ping me

can you tell me what was wrong with my approach?

theres something wrong in the logic
even the base case does not work
5
1 2 3 4 5

dont you think line no 11 will handle that case

i refered the logic from here… they are using recursion
i cant understand why recursion… so i tried to do without it

we can see that either u do a recursive call as in the gfg code because the iterative method is not helping

my code has simple logic
u can understand that as well

okay thanks i will give it a try