I am stuck in a problem, I need to solve a problem, here it is:
Write an Algorithm that finds an Index i in an array such that A[i] = i when 0<=i<=n-1, if no such index found return -1
I did this question in O(n) time but my fellows say that it can be done in less time some where near O(lg(n))
Can anyone helps me finding a better solution?? If so, Kindly reply to this post.. Thanks