Skip to content

Data structures

Data Structures: Organizing Information

Data structures are different ways of storing and organizing data so that it can be used efficiently.

Common Types of Data Structures

  1. Ordered Collections (Lists/Arrays):

    • Items are stored in a specific order.
    • Each item has an index (a position number, starting from 0).
    • Useful for: A list of names, a sequence of numbers.
  2. Unchangeable Collections (Tuples):

    • Similar to lists, but once created, they cannot be modified.
    • Useful for: Fixed data like GPS coordinates (Latitude, Longitude).
  3. Unique Collections (Sets):

    • No duplicate items allowed.
    • Items are not stored in any specific order.
    • Useful for: Tracking unique IDs, removing duplicates.
  4. Key-Value Pairs (Maps/Dictionaries):

    • Data is stored as a pair: a "Key" (like a label) and its "Value" (the data).
    • Useful for: Storing user profiles (Name: "VD", Age: 25).

Which one to use?

Choosing the right data structure is 50% of good programming. It makes your code faster and easier to read!