AS5 Flashcards

1
Q

Data Structure

A
  • A data structure is a collection of related items held together in memory.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Static Structures

A
  • Size is set at beginning of program.
  • Size cannot be changed.
  • Inefficient use of memory.
  • Easy to program.
  • Programmer will know how much space they take up.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Dynamic Structure

A
  • Size is not set.
  • Can expand or shrink as needed.
  • Efficient use of memory.
  • Harder to implement (need to keep track of size.)
  • Not held in contiguous memory. (Each element contains pointer to next element.)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Array

A

An array stores a sequence of variables that are all of the same type, grouped under one identifier.
- Normally static.
- Individual values are indexed.
- Can be multidimensional.
- Holds elements of the same type.
- Can iterate through.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

List

A
  • A list is dynamic as its size can change on execution.
  • New elements can be easily added and removed by changing pointers.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Two-Dimensional Array

A
  • Visualised as a grid with rows and columns.
  • An array of arrays.
  • The position of an element is referred to by two indices rather than one.
  • In Python, each element can be accessed by using a nested loop.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Searching an array

A
  • Arrays are usually immutable (can’t increase their size once created).
  • It isn’t possible to remove elements, but you can set them as null.
  • Then search for empty spaces and put new data there.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Records

A
  • A set of items all related to a single entity.
  • May contain items of more than one data type.
  • Can be multidimensional.
  • Fixed size.
  • Cannot iterate through a single record.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Dictionaries

A
  • Used to create record structures in Python.
  • Consists of two objects: a key and values.
  • The key identifies the element, the value is the corresponding data.
  • The key is unique.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly