By dynamic array, I mean an array that when it becomes full we replace it with a new array having greater capacity than the previous array.I read in a textbook that doubling the size of the array is the most efficient resizing. I want to know if this is in fact demonstrably true and not just a matter of personal preference.We will want to minimize the amount of resizing events, because each such event requires O(n) time where n is the number of elements in the list.We also should be careful not to make the list too big because it might be a waste of memory.Why does the author of my textbook say that 2 * array.length() is the magic number?
Why is it most efficient to resize a dynamic array to 2 * array.length()?
arrays;efficiency