Hacker News new | ask | show | jobs
by alayne 4776 days ago
That's why you use a growth factor, say doubling the backing array when you need to grow. That makes the amortized cost of adding an item constant.

The only case where a LL may be preferable are when you care about performance of inserting/deleting in the middle of a list.