Title: Algorithms & Data Structures — Lecture Notes
Course: Intro to Computer Science (Algorithms)
Topics Covered:
- Definitions:
• Algorithm: Step-by-step procedure for computations.
• Data Structure: Organized way to store and retrieve data efficiently.
- Common Data Structures:
• Arrays and Linked Lists: Array = contiguous memory; Linked List = nodes with
pointers.
• Stacks & Queues: LIFO and FIFO; applications in recursion and BFS.
• Trees & Graphs: Hierarchical data (binary trees), graph representations
(adjacency list/matrix).
• Hash Tables: Key-value mapping, average O(1) lookup.
- Big-O Notation:
• Time complexity: O(1), O(log n), O(n), O(n log n), O(n^2).
• Space complexity considerations.
- Basic Algorithms:
• Sorting: Bubble, Insertion, Merge, Quick (divide-and-conquer; average O(n log
n)).
• Searching: Linear search vs. Binary search (requires sorted array).
- Important Concepts:
• Divide and Conquer, Dynamic Programming (overlapping subproblems +
memoization), Greedy algorithms.
Example Problems:
- Implement merge sort and explain why it is stable and its time/space complexity.
- Use BFS to find the shortest path in an unweighted graph.