YEAR 1 CO1 WEEK 11 DATA STRUCTURES Flashcards

1
Q

What type of Data structures are there?

A

Static
Dynamic

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

What are static data structures?

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
3
Q

What are dynamic data structures?

A

Size of data structure can change during processing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
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
5
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
6
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
7
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
8
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
9
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
10
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
11
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
12
Q

What are Queues?

A

FIFO
Very front and back of the queue marked by pointers called ‘head’ and ‘tail’.
push=enqueue
Pop=dequeue

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

What are stacks ?

A

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

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

What is Assembly language?

A

Low level language
Can be read by humans and CPU
- Easy conversion between assembly and machine

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

What is the problems with assembly?

A

Coder needs to k ow a lot about hardware details
Only works for specific CPU
symbolic addressing

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

What is a Procedure ?

A

Takes input but doesn’t return anything

17
Q

What is a function?

A

Takes in input and reruns a value