Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Java ArrayListのensureCapacity()がconst 1.5または(oldCapacity * 3)/ 2 + 1で容量を拡張するのはなぜですか?
代わりに、配列が 1 つの要素だけ拡張された場合に生じる指数関数的な時間の増加を軽減するのに役立ちます。
ゼロでも小さい容量のアレイを作成できますが、小さい容量は比較的急速に拡大する必要があります。