Introduction to Data Structures
Definition
Data Structure is a way of organizing data inside memory for efficient processing along with operations like add, delete, search, etc., which can be performed on data.
Example
- Stack - with operations like push/pop/peek
Key Purposes
Data structures are used to achieve:
- Abstraction - Hiding implementation details
- Reusability - Code can be reused across different applications
- Efficiency - Optimal use of time and space resources
Performance Metrics
- Time Complexity - Time required to execute operations
- Space Complexity - Memory space required for data storage and operations
Types of Data Structures
1. Linear Data Structures
- Characteristics:
- Data is organized sequentially/linearly
- Data can be accessed sequentially
- Elements are arranged in a single level
- Examples:
- Array
- Stack
- Queue
- Linked List
2. Non-Linear Data Structures
- Characteristics:
- Data is organized in multiple levels (hierarchy)
- Data cannot be accessed sequentially
- More complex relationships between elements