The number of insertions
# Topic
Dynamic array
# Problem
The number of insertions
Assume that the size and capacity of a dynamic array are equal to 2 and 4 respectively, and the scaling factor is 2. After you perform nn insertions, the capacity of the array will become 1024. What is the minimum possible value of n?
Enter a number:
511
Correct.
# Hint & Explain
- What was the previous capacity, before it became 1024?
- This previous capacity should be exceeded.
- The array has 2 elements at the beginning, they don't count.
# Diagrammatize
编辑 (opens new window)
上次更新: 2022/09/25, 10:41:23