DSA Quick Revision Sheet
1. Array
- Collection of elements in contiguous memory.
- Fixed size.
- Example: int arr[5] = {1, 2, 3, 4, 5};
2. Linked List
- Nodes linked using pointers.
- Dynamic size.
- Types: Singly, Doubly, Circular.
- Example: 10 -> 20 -> 30 -> NULL
3. Stack
- LIFO structure (Last In First Out).
- Operations: push, pop, peek.
- Example: Plates stacked one above another.
4. Queue
- FIFO structure (First In First Out).
- Operations: enqueue, dequeue.
- Example: Waiting line in a store.
5. Searching
- Linear Search: Check each element one by one.
- Binary Search: Works on sorted array, divide and conquer.
6. Sorting
- Selection Sort: Find minimum element and swap.
- Merge Sort: Divide array, sort halves, merge.
- Quick Sort: Pick pivot, partition array.
7. Tree
- Hierarchical structure with nodes.
- Root node at top.
- Types: Binary Tree, BST, AVL, Heap.
- Traversals: Inorder, Preorder, Postorder.
8. Graph
- Collection of vertices (nodes) and edges.
- Types: Directed, Undirected.
- Traversals: BFS (Queue), DFS (Stack/Recursion).
9. Hashing
- Map keys to indexes using hash function.
- Handles collisions by chaining or open addressing.
10. Dynamic Memory Allocation
- Memory allocated at runtime using malloc(), calloc(), free().
- Used in linked lists, trees, etc.
11. Polish Notation
- Prefix form: Operator before operands (+ 3 4).
- Reverse Polish: Postfix form (3 4 +).
- Used in expression evaluation.
12. Sparse Matrix
- Mostly zeros, stored efficiently by saving only non-zero values.
- Types: COO, CSR, CSC.