i think searching for largest or smallest number may be O(n) so make a bst
and do it's inorder traversal last three elements will have max product

On Sun, Aug 7, 2011 at 2:05 PM, victory tunn <loserinvict...@gmail.com>wrote:

> @Punnet : why to find smallest three. SMALLEST here means negative
> numbers//
> lets say smallest1 is smaller than smallest2 and larget1>larget2>larget3
> I think we just need to find smallest 2( because -ve * -ve = pos);
>
> then result = max( smallest1*smallet2*largest1 , larget1,larget2,larget3)
>
> Please correct me If I am wrong
> Thanks,
>
> On Sun, Aug 7, 2011 at 9:31 PM, sukran dhawan <sukrandha...@gmail.com>wrote:
>
>> good approach
>>
>> On Sun, Aug 7, 2011 at 6:41 PM, Puneet Ginoria 
>> <punnu.gino...@gmail.com>wrote:
>>
>>> find the first three largest nos. and 3 smallest number(negatives).. then
>>> easily you can fig. out the solution..
>>>
>>> O(6n) solution i guess which is O(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.
>



-- 
*UTKARSH SRIVASTAV
CSE-3
B-Tech 3rd Year
@MNNIT ALLAHABAD*

-- 
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