Introduction - If you have any usage issues, please Google them yourself
When the number of elements in the array change, do not re-apply for the memory space, the array can continue to use. This will improve efficiency.
Algorithm for the machine, the "time" and "space" of the conflict is always there: a little more storage, running on the faster store less, running on more slowly. Embodied in here, this treatment is a space for time. Although the memory space is "wasted" some of the space, but in a very long time, as long as the space has not changed, run on a constant time complexity. Only when existing space is not enough, the only place to re-apply and release the memory operation. The easiest way is to double the growth, that is multiplied by 2, so the size of memory allocation is a power of 2.