Re: Algorithm Help
| From: | Ashley Sheridan | Date: | Tue, 01 Oct 2013 19:14:47 +0000 |
| Subject: | Re: Algorithm Help | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-322231@lists.php.net to get a copy of this message | ||
On Tue, 2013-10-01 at 15:09 -0400, Aziz Saleh wrote:
> DB or flatfile?
>
> I would create a matrix of all kids crossed with every kid. Everytime a kid
> is put in a home with another kid, ++ that index. When dispatching kids,
> sort by index ASC.
>
> Aziz
>
>
> On Tue, Oct 1, 2013 at 3:01 PM, John Meyer <johnmeyer@pueblocomputing.com>wrote:
>
> > On 10/1/2013 12:51 PM, Floyd Resler wrote:
> >
> >> Here's my task: A group of kids is going to be staying with different
> >> host families throughout the next 8 months. The number of kids staying
> >> with a host family can range from 2 to 10. When deciding which kids should
> >> stay together at a host family, the idea is for the system to put together
> >> kids who have stayed with each other the least on past weekends. So, if a
> >> host family can keep 5 kids, then the group of 5 kids who have stayed
> >> together the least will be chosen.
> >>
> >> I can't think of an easy, quick way to accomplish this. I've tried
> >> various approaches that have resulted in a lot of coding and being very
> >> slow. My idea was to give each group of kids a score and the lowest score
> >> is the group that is selected. However, this approach wound of iterating
> >> through several arrays several times which was really slow. Does anyone
> >> have any ideas on this puzzle?
> >>
> >> Thanks!
> >> Floyd
> >>
> >>
> >> Whatever solution you're going with will probably involve a relational
> > database of some sort.
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
This sounds remarkably like homework, which we can't help you with
unless you've got a specific problem that you're stuck with.
Thanks,
Ash
http://www.ashleysheridan.co.uk