YEAR 1 CO1 WEEK 11 DATA STRUCTURES Flashcards

1
Q

Define a static data structure.

A

Size of data structure is fixed when the structure is created and its size cannot change during processing.

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

Define a dynamic data structure.

A

Size of data structure can change during processing.

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

Define a mutable data structure.

A

Can change contents of data structure during processing.

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

Define an immutable data structure.

A

Cannot change contents, add or remove data items to data structure during processing.

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

State the pros and cons to a static data structure.

A

Inefficient as space might not be needed.
Limiting as you need to know in advance how large structure needs to be.
Amount of memory required can be calculated in advance and will be contiguous (and fast to read).
Fast to access data as memory location is known.
Easy to program.

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

State the pros and cons of a dynamic data structure.

A

Makes efficient use of space as memory allocated when needed.
Elements can be added or removed as required.
Tend to be more complicated to implement and use.
Memory requirement is unknown initially.
Slower to access as each memory address is allocated at runtime and so will be fragmented.
Needs to provide a function to calculate the size.

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

State properties and functions of lists.

A

When data items are related to one another they can be organised as a list.
Lists are usually dynamic and not stored continuously in memory.

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

State properties and function of tuples.

A

Similar to list that it stores a sequence of data items however cannot change add or remove data items at runtime so is immutable.
Can contain elements of different data types.

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

State properties and function of arrays.

A

Similar to lists but are static, number of elements are predefined when array is declared.
Collection of variables of same data types which grouped by single identifier.
Each variable in array called an element and accessed using an index which relates to its position in the array.

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

State properties and function of records.

A

A set of data types all related to single thing.
Unlike array can contain data items of more than one type.
Usually static.

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

Describe properties of a Queue.

A

Describes as First In First Out.
Very front and back of the queue marked by pointers called ‘head’ and ‘tail’.

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

Describe properties of a stack.

A

Closely related to queues but only one access point called the ‘top’.
Stacks are First In Last Out.

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