PCCST303 · Module 1: Basic Concepts of Data Structures
Data Structures
Introduction
A program works with data. But simply storing data is not enough: we also need to access it, insert it, delete it, search it, update it, sort it, and process it efficiently.
The way we organize and manage the data affects how efficiently these operations can be performed.
That organized representation is a data structure.
Definition
A data structure is a specialized way of organizing, storing, and managing data so that it can be accessed and modified efficiently.
How to think about it
Why data structures matter
The same data can often be stored in different ways.
Think of books in a library.
Books thrown randomly on the floor
Finding one book means checking every book
Books arranged on shelves by subject
You go directly to the right shelf
Books arranged alphabetically by title
You find any book in seconds
The books are the same. The information is the same. But the way they are organized changes how quickly you can find what you need. Data structures work the same way.
Common classification
Data structures fall into two broad families based on how their elements relate to one another.
Linear
Non-Linear
Linear structures preserve sequence; non-linear structures capture hierarchical or network relationships.
Linear structures (array, stack, queue, linked list) arrange elements one after another, so each element has at most one predecessor and one successor. Non-linear structures (tree, graph) allow an element to connect to multiple others, capturing hierarchy or networks that a simple sequence cannot represent.
Each of these structures gets its own lesson later, where we look at how it is implemented and the operations it supports in detail.
Key Idea
Choose the data structure based on the operations you need. Stack, queue, and array are not interchangeable: each exists because a particular operation set demands it.
Quick recall
- Data structure = organization of data + efficient operations.
- Choosing a data structure depends on the operations required.
- Stack, queue, and linked list are linear structures.
- Trees and graphs are non-linear structures.