Lesson 28/04/2020 dynamic and static data structure Flashcards

1
Q

what is a static data structure

A

A organisation or collection of data in memory that is fixed in size

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

what are 2 features of of a static data structure

A
  • max size needs to be known in advance

- memory cannot be reallocated once program is running

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

what is a dynamic data structure

A

A organisation or collection of data in memory that that can grow or shrink in size

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

what are 2 features of of a static data structure

A
  • Allows a programmer to control exactly how much memory will be used
  • unused memory is allocated or de-allocated when needed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

give an example of a dynamic data structure

A

a linked list

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

give an example of a static data structure

A

An Array

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

give a pro and con for a dynamic data structure

A

pro: Makes efficient use of memory
con: risk of overflow and underflow

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

give a pro and con for a static data structure

A

pro: easier to program
con: can be very inefficient

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