@naren:a[i] may exceed array limit.....sigsegv error amy result

On Sat, Aug 20, 2011 at 9:08 PM, Naren s <[email protected]> wrote:

>
>
> On Sat, Aug 20, 2011 at 9:07 PM, Naren s <[email protected]> wrote:
>
>> for(i=0 to n)
>> {
>> if(a[abs(a[i])-1]>0)
>> a[abs(a[i])-1] = -a[abs(a[i])-1];
>> else
>> printf("%d",abs(a[i]));
>>
>> }
>>
>> space : o(n)
>> time : o(1)
>>
>>
>>
>> On Fri, Aug 19, 2011 at 12:45 AM, *$* <[email protected]> wrote:
>>
>>> How to find duplicate element (only one element is repeated) from an
>>> array of unsorted positive integers..
>>> time complexity .. O(n)
>>> space .. o(1).
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> *Narayanan S,*
>> B.E., C.S.E., (final year),
>> College Of Engineering Guindy,
>> Anna University,
>> Chennai-25.
>>
>>
>
>
> --
> *Narayanan S,*
> B.E., C.S.E., (final year),
> College Of Engineering Guindy,
> Anna University,
> Chennai-25.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to