Click here to Skip to main content
15,921,179 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: Find Closest Sum of Numbers to a Given Number Pin
Luc Pattyn4-Apr-07 10:39
sitebuilderLuc Pattyn4-Apr-07 10:39 
QuestionRe: Find Closest Sum of Numbers to a Given Number Pin
David Crow4-Apr-07 10:54
David Crow4-Apr-07 10:54 
AnswerRe: Find Closest Sum of Numbers to a Given Number Pin
Bassam Abdul-Baki5-Apr-07 3:25
professionalBassam Abdul-Baki5-Apr-07 3:25 
AnswerRe: Find Closest Sum of Numbers to a Given Number Pin
samv985-Apr-07 11:48
samv985-Apr-07 11:48 
GeneralRe: Find Closest Sum of Numbers to a Given Number Pin
Luc Pattyn5-Apr-07 12:31
sitebuilderLuc Pattyn5-Apr-07 12:31 
GeneralRe: Find Closest Sum of Numbers to a Given Number Pin
cp98765-Apr-07 16:23
cp98765-Apr-07 16:23 
GeneralRe: Find Closest Sum of Numbers to a Given Number Pin
David Crow6-Apr-07 2:39
David Crow6-Apr-07 2:39 
GeneralRe: Find Closest Sum of Numbers to a Given Number Pin
cp98766-Apr-07 3:01
cp98766-Apr-07 3:01 
Consider the set {78, 12, 11, 11}, your algorithm gives 78 + 12 = 90 whereas the best is 78 + 11 + 11 = 100.

Even worse, consider the set {78, 35, 34, 31}, your algorithm gives 78 whereas 35+34+31 = 100.

I don't think you will find a general algorithm that does not grow at a similar rate to the brute force approach, but I could be wrong..


Peter

"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."

GeneralRe: Find Closest Sum of Numbers to a Given Number Pin
David Crow6-Apr-07 3:23
David Crow6-Apr-07 3:23 
GeneralRe: Find Closest Sum of Numbers to a Given Number Pin
cp98766-Apr-07 3:47
cp98766-Apr-07 3:47 
GeneralRe: Find Closest Sum of Numbers to a Given Number Pin
Bassam Abdul-Baki6-Apr-07 5:52
professionalBassam Abdul-Baki6-Apr-07 5:52 
GeneralRe: Find Closest Sum of Numbers to a Given Number Pin
samv986-Apr-07 6:09
samv986-Apr-07 6:09 
GeneralRe: Find Closest Sum of Numbers to a Given Number Pin
cp98768-Apr-07 21:49
cp98768-Apr-07 21:49 
GeneralRe: Find Closest Sum of Numbers to a Given Number Pin
samv989-Apr-07 9:06
samv989-Apr-07 9:06 
QuestionMath (statistics) problem that I just can't seem to get a grasp on Pin
David Crow4-Apr-07 4:00
David Crow4-Apr-07 4:00 
AnswerRe: Math (statistics) problem that I just can't seem to get a grasp on Pin
CPallini4-Apr-07 4:08
mveCPallini4-Apr-07 4:08 
AnswerRe: Math (statistics) problem that I just can't seem to get a grasp on Pin
Dan Neely4-Apr-07 4:13
Dan Neely4-Apr-07 4:13 
AnswerRe: Math (statistics) problem that I just can't seem to get a grasp on Pin
Rob Graham4-Apr-07 4:19
Rob Graham4-Apr-07 4:19 
GeneralRe: Math (statistics) problem that I just can't seem to get a grasp on [modified] Pin
cp98764-Apr-07 17:59
cp98764-Apr-07 17:59 
GeneralRe: Math (statistics) problem that I just can't seem to get a grasp on Pin
Rob Graham5-Apr-07 13:22
Rob Graham5-Apr-07 13:22 
GeneralRe: Math (statistics) problem that I just can't seem to get a grasp on Pin
cp98765-Apr-07 16:07
cp98765-Apr-07 16:07 
AnswerRe: Math (statistics) problem that I just can't seem to get a grasp on Pin
Frank Kerrigan2-May-07 6:33
Frank Kerrigan2-May-07 6:33 
QuestionAngle Algorithm Pin
Kushi Bobby4-Apr-07 1:23
Kushi Bobby4-Apr-07 1:23 
AnswerRe: Angle Algorithm Pin
CPallini4-Apr-07 1:46
mveCPallini4-Apr-07 1:46 
GeneralRe: Angle Algorithm Pin
cp98764-Apr-07 2:06
cp98764-Apr-07 2:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.