Part 1
Introduction to Data Structures
A data structure is a way of organizing data so it can be used efficiently.
It is a building block of programs and includes models for managing and processing data.
Types of Data Structures
- Primitive: Hold a single value (e.g., int, float).
- Non-Primitive:
- Linear (Array, Stack, Queue, Linked List)
- Non-linear (Tree, Graph)
Basic Operations on Data Structures
- Insertion
- Deletion
- Traversal
- Sorting
- Searching
Array - Definition
- Linear data structure
- Collection of homogeneous items
- Stored at contiguous memory locations
- Accessed via indices (starting from 0)
Key Terminologies in Arrays
- Type: Data type (int, float, char, etc.)
- Base: Address of first element
- Index: Position of elements (A[i])