Module M05 · 5 of 35 in teaching order · Beginner
Arrays
Contiguous storage, index arithmetic, and how a dynamic array grows while keeping append cheap.
Lessons
Why array indexing is O(1): one contiguous block, address = base + i × size, zero-based indices, bounds checks, and what arrays look like in C#, Python, Java and C++.
The loop patterns behind most array code: forward and backward scans, accumulators, early exit, adjacent pairs, find first and last, and safe traversal while modifying.
Why insert and delete in the middle of an array are O(n): shifting the tail, shift direction, the full-array case, swap-remove, and the built-ins in four languages.
How List<T>, Python list, ArrayList and std::vector grow: capacity vs size, resizing, and why append is amortized O(1). Interactive 3D, four languages.
Row-major and column-major layout, the address of element (r, c), why loop order matters for the cache, and jagged arrays in C#, Python, Java and C++.
Topics this module covers
The full module scope. Topics without a lesson above are not written yet.
- layout
- indexing
- traversal
- insert/delete/search
- dynamic arrays
- capacity
- resizing
- amortization
- multidimensional and jagged arrays
- implementation