@raghvan: take care of space complexity....you are using extra space that
too O(n) in worst case...

can be done in O(nlogn)

else it can be done in O(n) if the given array is sorted in two traversals
!!
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad




On Sun, Aug 7, 2011 at 11:35 AM, programming love <
love.for.programm...@gmail.com> wrote:

> So is q 1 a C++ question??
>
>
> On Sun, Aug 7, 2011 at 11:27 AM, hary rathor <harry.rat...@gmail.com>wrote:
>
>> no c doesn't
>>
>>  --
>> 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.

Reply via email to