click below
click below
Normal Size Small Size show me how
1.4.2 (a)
1.4.2
| Question | Answer |
|---|---|
| Arrays | A collection of items grouped under a single identifier - Contiguous - Static - Homogenous - Each item is identified by its index (position), starting at - Mutable - 3 dimensions: |
| 1 Dimensional (Arrays) | like a list, index like: [ ] |
| 2 Dimensional (Arrays) | like a table, index like: [row][column] |
| 3 Dimensional (Arrays) | like a cube, index like: [height] [length] [depth] |
| Contiguous | all data stored together in memory |
| Static | structure size cannot change at runtime |
| Homogenous | only support a single data type |
| Mutable | items can be changed/replaced after created |
| Records | Collection of related fields stored under a single identifier Heterogenous All attributes must be defined before use, with each field being given a data type before use |
| Setting up a record | 1. Define the structure and fields (names + data types) 2. Declare variables to go in it (the row headings) 3. Assign data |
| Heterogenous | can store more than one data type |
| Lists | Like arrays, but: - Heterogeneous - Not contiguous - Dynamic |
| Dynamic | the size of the structure can change at runtime |
| Tuples | (not necessarily 2 items) Like arrays, but: - Immutable - Heterogeneous Useful for data that isn't changed but accessed by index Use () in python Can include lists inside as elements |
| Immutable | data cannot be modified |