Storage representations
Introduction / Definition
A storage representation describes how an abstract data structure is physically stored. Arrays use contiguous indexed storage, while linked structures use nodes and references. Different representations can implement the same ADT. The choice affects memory usage and operation complexity.
Syntax / Structure / Formula
ADT โ representation โ memory layout
Detailed Explanation
An array list supports fast indexed access, while a linked list can efficiently insert when a node position is already known.
Example
Example: A stack can use an array plus top index or linked nodes.
Output / Result
Both implementations provide stack behavior with different performance characteristics.
Important Points / Notes
- Representation is an implementation choice.
- Consider workload and complexity.
Mini Practice Question
When is an array representation preferable to linked storage?