PadhaikoAll subjects

Past exam question: 2076 Baisakh (Back), Q4

Data Structure and Algorithms · 6 marks

Open in the Padhaiko app

Topic: Linked List

Question

Explain array representation of list ? How is it different from dynamic list?

Solution

Array Representation of List: In an array-based list, elements are stored in contiguous slots of a fixed-capacity array items[MAX] alongside an integer size tracking the active count:

Differences from Dynamic List (Linked List):

FeatureArray List (Static)Dynamic List (Linked List)
Memory AllocationFixed compile-time contiguous blockRuntime heap allocation per node (malloc/free)
Size GrowthBounded by MAX (can overflow)Grows/shrinks dynamically until heap RAM ends
Random Access via index sequential traversal from head
Insert / Delete (Middle/Head) data shifting pointer rewiring (once position is reached)
Memory OverheadNo pointer overhead (but unused slots waste space)Extra pointer field per node (no unused capacity waste)
Answer:

An array list stores items in contiguous items[MAX] slots with random indexing and insertion/deletion shifting, whereas a dynamic (linked) list allocates scattered nodes at runtime with flexible size and pointer-based splicing at the cost of sequential access and pointer storage.

All past exam questions for Data Structure and Algorithms