wu :: forums
« wu :: forums - Find the largest sum from the set of +ve integers »

Welcome, Guest. Please Login or Register.
Nov 28th, 2024, 5:33pm

RIDDLES SITE WRITE MATH! Home Home Help Help Search Search Members Members Login Login Register Register
   wu :: forums
   riddles
   cs
(Moderators: william wu, ThudnBlunder, towr, Icarus, SMQ, Grimbal, Eigenray)
   Find the largest sum from the set of +ve integers
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Find the largest sum from the set of +ve integers  (Read 467 times)
hary
Junior Member
**





   


Posts: 107
Find the largest sum from the set of +ve integers  
« on: May 15th, 2009, 6:08am »
Quote Quote Modify Modify

Given a set 'S' of positive integers. Find the largest sum 'c' s.t. c = a+b where a,b,c belong to the Set 'S'.
IP Logged
hary
Junior Member
**





   


Posts: 107
Re: Find the largest sum from the set of +ve integ  
« Reply #1 on: May 21st, 2009, 10:09am »
Quote Quote Modify Modify

strange to see no one responded on this thread so far.  
Well one oif the solutions that i can think of the problem is  
 
1. We know solution for the problem  
Given an array (sorted) and a no 'X' and we can find out the pairs a,b that sum upto x in O(n) time.  
 
Use this as the base solution where X will range from arr[n-1] to arr[2]. This solution has an O(n*n) complexity. What i am looking for is a more efficient solution if someone can come up with.  
 
IP Logged
Aryabhatta
Uberpuzzler
*****






   


Gender: male
Posts: 1321
Re: Find the largest sum from the set of +ve integ  
« Reply #2 on: May 21st, 2009, 10:13am »
Quote Quote Modify Modify

This is related to the 3SUM problem, and doing better than O(n^2) is an open question.
IP Logged
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board