Lists, tuples arrays and records(1.4.2 a) Flashcards
What are compound data types?
allows us to store multiple pieces of data in one place
What are arrays?
ordered collection of elements of all the same type and a fixed length
Arrays
good for storing lots of data in a single place
can access each individual element
can update each element
can’t add or remove elements once defined
What is a 2 dimensional array?
store an array in another array
What are lists?
mutable ordered collection of items of any type with a finite length
What is mutable?
able to be changed
Lists
access any length
change an item
add or delete an item
test if the list is empty
access the first and last item
What are tuples?
like lists except they cannot be modified after definied
Tuples
explicitly read only
faster to access than lists due to reduced set of possible actions
What is a record?
fixed collection of fields of any type that is a finite length
What is dynamic?
the size can change at runtime
What is static?
the size cannot change at runtime
Arrays static or dynamic?
static
Lists static or dynamic?
dynamic
Records static or dynamic?
dynamic/static
Tuples static or dynamic?
static/dynamic