Efficient coding considered harmful?

Steven Ryan smryan at garth.UUCP
Thu Nov 3 08:57:43 AEST 1988


>[the context is realloc()]
>
>Not so.  The standard technique is to increase the size by a MULTIPLICATIVE
>factor, not an additive increment.  The best factor is data-dependent; I
>tend to use 1.5 because that's what InterLisp used, 2 is pretty popular.
>The total cost in this case remains O(N), N being the final size.

However, this makes the space cost O(1.5**n), exponential.



More information about the Comp.lang.c mailing list