Ideally, yes it can. Though i would be happy even if someone gives a
good answer for non-negative values.

On Mon, Jun 20, 2011 at 6:28 PM, Akshata Sharma
<akshatasharm...@gmail.com> wrote:
> @Navneet: does the set contains negative elements also?
>
> On Mon, Jun 20, 2011 at 12:26 PM, pacific :-) <pacific4...@gmail.com> wrote:
>>
>> @vaibhav : Please note that more than two numbers can sum upto k.
>>
>> On Mon, Jun 20, 2011 at 12:21 PM, vaibhav shukla <vaibhav200...@gmail.com>
>> wrote:
>>>
>>> sort the array using merge sort : order nlogn
>>> take the first element,subtract it with 'k' , then search the result
>>> using binary search in rest of the array : order nlogn
>>> hence u get two elements which sum up to K in order nlogn
>>>
>>> On Mon, Jun 20, 2011 at 12:14 PM, Navneet Gupta <navneetn...@gmail.com>
>>> wrote:
>>>>
>>>> Right, in the worst case, complexity with be O(2^N).
>>>> So what are the possible optimizations here? Would building pre-computed
>>>> data structures with intermediate sum values help in finding such pairs in
>>>> less complexity? I think then we can apply dynamic programming to find such
>>>> pairs.
>>>>
>>>> On Mon, Jun 20, 2011 at 12:09 PM, oppilas . <jatka.oppimi...@gmail.com>
>>>> wrote:
>>>>>
>>>>> I think its a NP problem. The solution complexity can go up O(2^N) in
>>>>> worst case.
>>>>>
>>>>> On Mon, Jun 20, 2011 at 11:55 AM, Navneet Gupta <navneetn...@gmail.com>
>>>>> wrote:
>>>>>>
>>>>>> Given a set of integers , find a set of numbers such that they sum to
>>>>>> a given number k .
>>>>>> Notice the set of numbers can have 2 or more than 2 numbers.
>>>>>>
>>>>>>
>>>>>> --Navneet
>>>>>>
>>>>>> --
>>>>>> 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.
>>>>
>>>>
>>>>
>>>> --
>>>> --Navneet
>>>>
>>>> --
>>>> 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.
>>>
>>>
>>>
>>> --
>>>   best wishes!!
>>> Vaibhav Shukla
>>>     DU-MCA
>>>
>>> --
>>> 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.
>>
>>
>>
>> --
>> regards,
>> chinna.
>>
>> --
>> 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.
>



-- 
--Navneet

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