[Exceptional C++ Style] Item 26 -- Data Formats and Effic iency

Harris, Richard richard.harris at csfb.com
Mon Jan 31 11:01:41 EST 2005


Ric Parkin wrote:
<snip>
Even more minor point, it doesn't have to double to achieve the complexity
requirements - IIRC there's some minimum value that is enough (somewhere
around 1.3? - sqrt(5)/2 has popped into my head, but may be wildly wrong) but
*anything* above that will work. And some implementations take advantage of
this - I think Dinkumware changed to 1.5 in order to reduce memory overhead. 
</snip>

I suspect you're talking about the Golden Ratio which is equal to
(1+sqrt(5))/2 and turns up all over the place.
However, I was under the impression that any reservation (constant
proportionally) greater than that required by push_back would lead to
amortized constant time. I know the Golden Ratio can be used in searching for
local optima (this is described in Numerical Recipes in C, for example).
Richard
[ *** LongSig auto truncated *** ]



More information about the Effective-cpp mailing list