I would like to discuss resizing strategies for arrays please. If you have an array of $k$ initial size and it gets full, so you would like to choose from one of the following approaches:
Approach 1: if array get full, then we resize the array by $k$ constant.
Approach 2: if array get full, then we resize the array by doubling the previous size.
Approach 3: if array get full, then we follow $3k, 5k, 7k, 9k, \cdots$ etc resizing.
Now to compare approaches:
- Approach 1 is time consuming as we do resizing more frequently.
- Approach 2 is memory consuming.
- Approach 3 is most intuitive one because it adopts to higher frequency of PUSH calls.
Problem: How approach 3 is more intuitive compared to approach 2 please? Both are similar as I see them.