@aditya : dis is obviously correct bt here complexity will be O(n) bt we are
asked to gv O(log n) solution

On Mon, Aug 15, 2011 at 12:37 AM, aditya kumar <aditya.kumar130...@gmail.com
> wrote:

> for(j=0;j<n;j++)
> {
> if(a[j]==j)
>  return j;
>  else
>  continue ;
> }
>
> this shud also be correct right ??
>
> On Mon, Aug 15, 2011 at 12:31 AM, Akash Mukherjee <akash...@gmail.com>wrote:
>
>> just my 2 cents ---- in d binary search, replacing key with mid, ie
>> if(a[mid] > mid)
>> check lower half
>> else upper half
>>
>> should work??
>>
>>
>> On Mon, Aug 15, 2011 at 12:26 AM, aditi garg 
>> <aditi.garg.6...@gmail.com>wrote:
>>
>>> Given an ordered array A[1…n] with numbers in strictly increasing
>>> order. Find a ‘j’ such that A [j]=j or -1 if no such number exist in
>>> o (log n).
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Aditi Garg
Undergraduate Student
Electronics & Communication Divison
NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
Sector 3, Dwarka
New Delhi

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to