Past exam question: 2075 Baisakh (Back), Q3
Open in the Padhaiko appQuestion
Explain array representation of list? How does it differ from dynamic list?
Solution
Array Representation of List: An array list stores sequential elements inside a contiguous fixed-size array items[MAX] alongside a length counter size:
- Random access
get(i)is via direct address offset. - Inserting or deleting at index
itakes due to shifting subsequent elements.
Comparison with Dynamic List (Linked List):
| Criterion | Array (Static) List | Dynamic (Linked) List |
|---|---|---|
| Size | Fixed at MAX; risks overflow or wasted RAM | Grows/shrinks dynamically per node |
| Memory Layout | Single contiguous block | Scattered heap nodes linked by pointers |
| Access Time | direct indexing | sequential traversal |
| Insert/Delete (Head/Mid) | element shifting | pointer update (given predecessor) |
Answer:
An array list uses contiguous fixed-capacity storage with indexing and shifts on insert/delete, whereas a dynamic list uses heap-allocated pointer-linked nodes with dynamic sizing and splicing at the cost of sequential access.