If anybody facing this problem then do not call a BS function instead do an iterative BS within the same Search funtion only. It worked for me after wasting 2 hrs
May be you are passing your array using pass by value which takes O(n) time itself.
No was passing it by reference
I am doing iterative binary search but still it is giving the same error!!
you have to call Binary search only for one segment