Re: algorithm possibility for php /mysql
| From: | Moriyoshi Koizumi | Date: | Thu, 16 Jan 2003 15:01:28 +0000 |
| Subject: | Re: algorithm possibility for php /mysql | ||
| References: | 1 | Groups: | php.i18n |
| Request: | Send a blank email to php-i18n+get-416@lists.php.net to get a copy of this message | ||
This topis has at all nothing to do with php internationalization
that this list is for. Please forward this to php-general@lists.php.net.
Moriyoshi
On Thu, Jan 16, 2003 at 07:46:20AM -0500, bda wrote:
> I have an issue that I am trying to solve. I can script this problem using
> fixed length arrays, but I am seeking a more simplified and elegant
> solution. At the heart of the problem is dealing with variable length
> arrays and comparison.
>
> In essence this is the problem. If a table row record
> (master_times) contains all possible dates and times for an event, a
> seperate table row record (response_times) will containt all dates and times
> that an individual is availalbe for that event, based on the date and times
> allowed as specified in master_times. This data is exploded to populate an
> array with User as key, and all values of that key being date/time.
>
> Now, how can I determine, in a case where x users have replied with y times
> where one or more times(z) exisists in all occurances of user(x)? Or, if
> none exists, the closest match? See grid below. This doing it by a fixed
> length array where summing is used, but I hope that there is a better way.
>
> | Monday 0800 | Monday 0900 |Thursday 1000
> John | True | False | False
> Jane | False | True | True
> Mike | True | False | False
>
> In this case, Monday at 0800 would be best, even though it is not all true.
> So ouput should be John and Mike on Monday at 0800. Again, consider that
> this must scale as times could be as large as 200 records and Users could
> push 100. So I beleieve that just running fixed lenth arrays is kind of
> inefficient. Ideas
> anyone?
>
>
>
>
>
> --
> PHP Internationalization Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>