java - Resizing an array: How much should it be done? -
i implementing stack using array. , needs grow @ point push items on stack. wondering how should resized? should resize constant number? please let me know.
from 1 hand, don't want often, on big sets of data. other hand, don't want waste memory. strategy multiply size 2 (or 1.5, if more concerned memory on performance). doubling adapt possible growth, , predictable number of growth operations.
Comments
Post a Comment