[Gllug] OT: algorithm needed

Peter Corlett abuse at cabal.org.uk
Sun Aug 10 20:48:18 UTC 2008


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.


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




More information about the GLLUG mailing list