5. Data Structures Flashcards
What is a data structure?
A data structure is a data organization, management, and storage format that is usually chosen for efficient access to data.
What is a Static Data Structure
SDS is a fixed-size data structure that doesn’t change in size during program execution. It has a predetermined maximum capacity which cannot be altered once set.
Examples: Arrays
+ Faster access time as its fixed
+ Predictable memory usage
- memory utilization may be inefficient
What is a Dynamic Data Structure?
A DDS is a flexible data structure that can change in size during program execution. It allows elements to be added or removed as needed.
+ Flexibility (well suited for situations where size of data is not known in advance or is likely to change)
+ Reduced memory waste
Characteristics of an Array, Record and a List
Array:
- An array is a data structure that holds elements of the same data type
- each position is identified by an index which allows for efficient access
- may result in wasted memory if not fully utilized
- fixed size that once set cannot be altered
Record:
- modelling complex entities with multiple attributes
- access elements by refencing a specific key or field name
- store elements of different data types
List:
- store elements of different data types
- can change in size dynamically during execution
- each position is identified by an index which allows for efficient access