MODULE-1: Data Structures (Simplified Notes)
1. What is a Data Structure?
- A method to store and organize data in a computer.
- Helps in efficient access, insertion, deletion, etc.
- Common examples: Array, Linked List, Stack, Queue, Tree, Graph.
- Not a language, used in any programming language.
2. Types of Data Structures
A. Primitive: int, char, float, etc. (single value)
B. Non-Primitive:
- Linear: Array, Linked List, Stack, Queue
- Non-Linear: Tree, Graph
3. Linear Data Structures
- Array: Fixed-size, same-type elements, index-based.
- Linked List: Elements linked via pointers, dynamic size.
- Stack (LIFO): Push, Pop, Peek.
- Queue (FIFO): Enqueue, Dequeue, Front, Rear.
4. Non-Linear Data Structures
- Tree: Hierarchical data (e.g., folder system).
- Graph: Nodes and edges (e.g., social networks).
5. Why Use Data Structures?
- Faster operations (search, insert).
- Save memory.
- Handle multiple requests/users.
6. Advantages of Data Structures
- Efficiency, reusability, and abstraction.
7. Operations on Data Structures
- Traversing, Insertion, Deletion, Searching, Sorting, Merging.
8. Stack Details (Using Array)
- push(): Add to top.
- pop(): Remove from top.
- display(): Print top to bottom.
- Applications: Expression evaluation, backtracking, function calls.
9. Arithmetic Expressions & Stack
- Infix: A + B
- Prefix: + A B
- Postfix: A B +
- Use stack for conversions and evaluation.
10. Queue Details (Using Array)
- enQueue(): Add to rear.
- deQueue(): Remove from front.
- display(): Print queue.
- FIFO method with front and rear pointers.
11. Applications of Queue
- CPU scheduling, interrupts, traffic management, media queues.