ideal growth rate for a dynamically allocated array

16
allocate 16*1.5=24  deallocate 16
allocate 24*1.5=36. deallocate  16+24=40
allocate 36*1.5=54. deallocate  40+36=76
allocate 54*1.5=81 deallocate.  76+54=130
allocate 81*1.5=121.5 < 130 reuse
choosing 1.5 as the factor allows memory reuse after 4 reallocations; 1.45 allows memory reuse after 3 reallocations; and 1.3 allows reuse after only 2 reallocations.
Spread the love