array
data structure
programming
computer science
arrays

What's the name of this array data structure?

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

There is no single answer to "what is this array data structure called?" until you describe the behavior. In practice, developers usually mean one of a small group of related structures: a fixed array, a dynamic array, a circular buffer, a jagged array, a sparse array, or a deque-like segmented structure.

Start with the most common name: dynamic array

If the structure behaves like an array but can grow as elements are appended, the usual name is dynamic array. In different languages it may also be called:

  • vector
  • ArrayList
  • resizable array

Python's built-in list is the classic example of a dynamic array:

python
1values = []
2values.append(10)
3values.append(20)
4values.append(30)
5
6print(values[1])  # 20

It gives fast index access like an array, but it can expand when needed. If your mystery structure has contiguous indexed access and occasional resizing, "dynamic array" is probably the right name.

If the ends wrap around, it is probably a circular buffer

If the structure uses a fixed array internally but treats the end as connected back to the beginning, the usual name is circular buffer or ring buffer.

A simple example:

python
1class RingBuffer:
2    def __init__(self, size):
3        self.data = [None] * size
4        self.size = size
5        self.write_index = 0
6
7    def append(self, value):
8        self.data[self.write_index] = value
9        self.write_index = (self.write_index + 1) % self.size
10
11
12buffer = RingBuffer(3)
13buffer.append("A")
14buffer.append("B")
15buffer.append("C")
16buffer.append("D")
17
18print(buffer.data)

If the defining property is wraparound indexing with fixed capacity, it is not just "an array." It is specifically a circular buffer.

If inner rows have different lengths, it is a jagged array

If you have an array of arrays where each inner array can have a different length, the standard name is jagged array:

python
1matrix = [
2    [1, 2, 3],
3    [4, 5],
4    [6]
5]
6
7print(matrix[1][0])  # 4

This differs from a rectangular 2D array because the row sizes are not uniform.

If most positions are empty, it may be a sparse array

If the structure conceptually has many indexes but only a few populated values, the right name may be sparse array or, more broadly, a sparse representation.

A Python dictionary often acts as a sparse array:

python
1sparse = {
2    2: "hello",
3    1000: "world",
4}
5
6print(sparse.get(2))
7print(sparse.get(999, None))

This is useful when storing a huge mostly-empty index space as a dense array would waste memory.

Some structures are really deques or segmented arrays

If the structure supports efficient insertion or removal at both ends and may be internally chunked rather than fully contiguous, it may be closer to a deque than a plain array.

For example, Python's collections.deque is not just a resizable array:

python
1from collections import deque
2
3items = deque([1, 2, 3])
4items.appendleft(0)
5items.append(4)
6
7print(items)

If the behavior is "array-like" but optimized for both ends rather than random insertion in the middle, "deque" is often the better name.

The right name comes from the guarantees

To identify the structure, ask these questions:

  • Is the size fixed or resizable?
  • Is memory logically contiguous or segmented?
  • Are insertions optimized only at the end, or at both ends?
  • Does indexing wrap around?
  • Are most positions empty?
  • Do nested rows have different lengths?

Those properties matter more than how the structure looks at first glance.

Common Pitfalls

The biggest mistake is calling every indexed collection an array. Many array-like structures have different performance guarantees and more specific names.

Another common issue is focusing on syntax instead of behavior. Two languages may use bracket syntax for structures with very different internals.

People also confuse dynamic arrays and linked lists because both can "grow." Growth alone does not tell you the structure type.

Finally, if the structure is optimized for both front and back operations, "deque" is often a better answer than "array."

Summary

  • A resizable array-like structure is usually called a dynamic array.
  • A fixed-capacity wraparound structure is usually a circular buffer or ring buffer.
  • An array of unequal-length rows is a jagged array.
  • A mostly-empty indexed structure is often a sparse array representation.
  • The correct name depends on the structure's behavioral guarantees, not just its syntax.

Course illustration
Course illustration

All Rights Reserved.