Welcome to the Monastery | |
PerlMonks |
Re^2: Help thinking about an alternate algorithmby Limbic~Region (Chancellor) |
on Jan 15, 2014 at 16:49 UTC ( [id://1070706]=note: print w/replies, xml ) | Need Help?? |
LanX,
Not sure I get the problem I really like the outfit analogy because I can't discuss the real data (work). Imagine you have a classroom of kids. Each kid is told that the next day they must all wear a hat, a shirt, a pair of pants, a belt and a pair of shoes. They may choose to wear a either a red, white or a blue hat. The choices for shirt are larger (red, white, blue, green, yellow and orange), etc. The number of students will always be small in comparison to the number of distinct possible outfits. What you need to do is identify the two students who had the largest number of differences between them. In my example, the greatest distance is 5 (hat, shirt, pants, belt and shoes). It doesn't matter how many items are in a particular category - if they chose a different color hat then the distance is 1, if they also chose a different color belt the distance goes up to 2. As I have said, I know that comparing all students against all other students is necessary in the worst case. I was hoping there would be a way to say I currently have found two students with at least 3 things different so I shouldn't consider students who have at least 2 things the same because they can't possibly exceed my current high water mark. Cheers - L~R
In Section
Seekers of Perl Wisdom
|
|