On 4/20/11 Wed Apr 20, 2011 3:17 PM, "shawn wilson" <ag4ve...@gmail.com> scribbled:
> On Apr 20, 2011 1:05 AM, "ai nguyen" <aichuab...@gmail.com> wrote: >> >> >> A population of 20 cows, each one has age and weight (known). > > Irrelevant I don't think so. The fact that there are 20 cows and 2 attributes for each is central to the problem. > >> Device this population into 2 group, each group has 10 cows. >> > two data sets to compare Not quite. Two sets to create out of the given initial set. > >> Questions: >> How to pick a cow on each group so that a distribution of AGE and >> WEIGHT on each group is similar. > > Which property should have more weight? If neither, than just add them up > and use that result to compare. The sort and loop for each set and store the > index in a value if set1 - set2 is less than the old result. Both properties should probably have equal weight. You must first define what you mean by "distribution". There are several measures of distribution: average, standard deviation, mean, median, etc. There are probably more complex measures that only students of statistics will know about (not me). Having selected a measurement method for comparing distribution, you must then think of a partitioning algorithm that will create two sets with the closest distribution values. I bet a random selection won't do too bad. You might then want to try picking a pair of cows, swapping them, and seeing if it improves the distribution comparison. > > Show your strategy or/and implement >> it in PERL. > > Irrelevant. Not totally irrelevant to the problem of implementing the solution in Perl. > >> >> Thanks >> > Yeah. But when you ask questions in the future, think about the task, try to > do something (hell, try to fail if you must) and then post. When everyone > knows its homework that probably means that you've failed at failing and > should sleep off your hangover and try again. I canb agree on that point. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/