A safer File.readln
Shachar Shemesh via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jan 23 06:15:54 PST 2017
On 23/01/17 15:18, Andrei Alexandrescu wrote:
> On 1/23/17 5:44 AM, Shachar Shemesh wrote:
>> If, instead of increasing its size by 100%, we increase it by a smaller
>> percentage of its previous size, we still maintain the amortized O(1)
>> cost (with a multiplier that might be a little higher, but see the trade
>> off). On the other hand, we can now reuse memory.
>
> Heh, I have a talk about it. The limit is the golden cut,
> 1.6180339887498948482... The proof is fun. Anything larger prevents you
> from reusing previously used space. -- Andrei
>
I was going to ask for the proof, but I first went to refresh my memory
a little about the golden ratio, at which point the proof became
somewhat trivial.
Shachar
More information about the Digitalmars-d
mailing list