Intro to Algorithms & Data Structures — Lecture Notes
Author: Lecture Notes Generated: 2025-09-05
Overview
Key algorithmic concepts: complexity, searching, sorting, and fundamental data structures.
1. Algorithm Analysis
- Time complexity (Big-O notation): worst-case growth rates.
- Common complexities: O(1), O(log n), O(n), O(n log n), O(n^2).
2. Basic Data Structures
- Arrays, linked lists, stacks, queues, hash tables, trees.
- Tradeoffs: access time, insertion/deletion costs, memory.
3. Searching & Sorting
- Linear search O(n), binary search O(log n) (requires sorted array).
- Sorting algorithms: selection, insertion, merge sort (O(n log n)), quicksort average O(n log
n), worst-case O(n^2).
4. Recursion & Divide-and-Conquer
- Solve by breaking into subproblems (e.g., merge sort).
- Recurrence relations and Master Theorem basics.
Practice Problems
1. Given a sorted array, write (or outline) binary search and state its complexity.
2. Compare quicksort and merge sort: stability, space use, average/worst-case time.
3. For a simple hash table with chaining, explain what happens as load factor increases and how
to mitigate.