[Gllug] OT: algorithm needed

salsaman at xs4all.nl salsaman at xs4all.nl
Sun Aug 10 21:38:29 UTC 2008


On Sun, August 10, 2008 22:48, Peter Corlett wrote:
> On 10 Aug 2008, at 21:33, salsaman at xs4all.nl wrote:
> [...]
>> However, I want the last read to be as close to max_block_size as
>> possible.
>> E.g. if total==100, max==45, I could read:
>> 45, 45, 10.
>>
>> However it would be preferable to read:
>>
>> 40, 40, 20, or better yet:
>> 35, 35, 30
>
> With the requirements as you described, 10, 45, 45 would be even more
> optimal. Are you sure that's really what you want? If so, you can just
> do a quick modulo calculation, make the first transfer be the "short"
> one and the rest be of maximum size.
>

That's right - I should have added that each read should read as close to
the max as possible (including the final read).


Gabriel.


-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list