Lesson 28/04/2020 dynamic and static data structure Flashcards
what is a static data structure
A organisation or collection of data in memory that is fixed in size
what are 2 features of of a static data structure
- max size needs to be known in advance
- memory cannot be reallocated once program is running
what is a dynamic data structure
A organisation or collection of data in memory that that can grow or shrink in size
what are 2 features of of a static data structure
- Allows a programmer to control exactly how much memory will be used
- unused memory is allocated or de-allocated when needed
give an example of a dynamic data structure
a linked list
give an example of a static data structure
An Array
give a pro and con for a dynamic data structure
pro: Makes efficient use of memory
con: risk of overflow and underflow
give a pro and con for a static data structure
pro: easier to program
con: can be very inefficient