Data Structures Flashcards
(18 cards)
What determines the values a variable can store and the operations that can be performed on it?
The variable’s data type.
What is an integer an example of?
A primitive data type.
What are the primitive data types?
Int, Real (fractional numbers), Boolean (true/false), character, and string.
Is a string considered a primitive data type?
Yes, although it’s a collection of characters, it’s usually classified as a primitive data type.
What is a composite or compound data type?
A data type built by combining primitive data types.
What is a data structure?
A collection of data that is organised to allow efficient processing.
What is an abstract data type?
A conceptual model that describes how data is organised and what operations can be performed.
What is a static data structure?
A structure that reserves memory for a fixed amount of data.
Can the size of a static array be changed?
No, a new array must be created and data copied.
What is an advantage of static arrays?
Efficient direct access by index.
What is a disadvantage of static arrays?
Inefficient memory use if size is overestimated.
What is a dynamic data structure?
A structure with memory capacity that is not fixed.
What is an advantage of a linked list?
Size is not predetermined.
What is a disadvantage of a linked list?
Elements cannot be accessed directly.
Why do programmers use libraries for data structures?
To use well-tested and documented code.
Where is memory for dynamic structures like linked lists taken from?
From a memory heap.
Do high-level languages manage heap memory automatically?
Yes, for example in Python.
Do low-level languages manage heap memory automatically?
No, you must manage it manually in languages like C.