Lesson 027

Introduction to Lists

Dynamic Arrays That Grow & Shrink

1:00

How dynamic arrays (lists) grow and shrink on demand, why append is amortized O(1), and when to prefer a list over a fixed array.

By the end, you can

  • Explain why a list can grow and shrink while a fixed array cannot.
  • Describe what happens internally (allocate, copy, headroom) when a list resizes.
  • Distinguish **length** from **capacity** and state what happens to each when items are removed.
  • Explain **amortized O(1)** append and why doubling is the key to making it work.
  • State the time complexity of access, append, insert, and search on a list.
  • Identify and fix the off-by-one indexing pitfall and the mutate-while-iterating pitfall.
  • Recognize the list equivalent in Python, JavaScript, Java, and C++.
  • Decide when a list is the right data structure versus when a fixed array suffices.
Up next in Linear Data Structures
Questions or feedback?