Introduction to Data Structures - Class Notes
# Introduction to Data Structures
## What is a Data Structure?
A data structure is a way of storing and organizing data so that it can be accessed and modified
efficiently.
## Types of Data Structures
1. **Linear Data Structures**
- Arrays
- Linked Lists
- Stacks
- Queues
2. **Non-Linear Data Structures**
- Trees (Binary Trees, BST)
- Graphs
## Arrays
- Fixed size.
- Elements stored in contiguous memory locations.
- Allows random access.
## Linked Lists
- Collection of nodes where each node contains data and a pointer to the next node.
- Dynamic size.
## Stacks
- Follows LIFO (Last In First Out).
- Operations: push, pop, peek.
## Queues
- Follows FIFO (First In First Out).
- Operations: enqueue, dequeue.
## Trees
- Hierarchical data structure.
- Consists of nodes connected by edges.
## Graphs
- Consists of vertices (nodes) and edges.
- Can be directed or undirected.
## Why Learn Data Structures?
- Improve problem solving.
- Efficient data manipulation.
- Foundation for algorithms.
---
*These class notes were prepared for quick revision. Suitable for beginners studying computer
science.*