Data Structures: Organizing Information
Ways to organize data
Why structure matters
Programs often need to keep many pieces of information. Data structures help organize information so it can be found, changed, and used efficiently.
Common beginner data structures
List / array
- Stores items in order
- Good for sequential access
Dictionary / map
- Stores key-value pairs
- Good for looking up values by name
Choosing the right structure
If order matters, a list is useful. If you need labels like name or age, a dictionary is often better.
Which structure is best for storing a list of shopping items in order?
A list keeps items in sequence.
Correct answer: List
What is a key in a key-value structure?
The key acts like a name for the stored value.
Correct answer: A label used to find a value
Thinking about access
Different structures make different tasks easier. A list is good when you want the first, second, or third item. A dictionary is good when you want to look up information by label.
Which structure is especially useful for pairs like country -> capital?
Key-value pairs are naturally represented by dictionaries.
Correct answer: Dictionary
Why are data structures useful?
Good structures make programs simpler and faster to work with.
Correct answer: They help organize information so it can be handled efficiently