Abstract Data Types (ADTs)
tags
#cs
Definition
An ADT is a pure interface that is concerned only with the what - what data is stored, what we can do with the data - and not the how - how a computer actually stores the data and implements these operations
Types of ADT
Set
- Data: a collection of unique elements where order doesn't matter
- Operations: get size, insert element (without introducing duplicates), removing specified values, checking membership
List
- Data: a sequence of elements (that do not need to be unique)
- Operations: get size, access element by index, insert a value at a given index, remove a value at a given index
access includes reading and mutating ?
Implementations:
Mapping
- Data: a collection of key-value pairs, where each key is unique and associated with a single value
- Operations: get size, lookup a value for a given key, insert new key-value pair, remove key-value pair, update the value for a given key
Iterable
- Data: a collection of values (that do not need to be unique)