🖨️ Printing Instructions: Press Ctrl/Cmd + P and select "Save as PDF".
1

Design and Analysis of Algorithms

Introduction & Fundamentals

2

Introductions

3

Instructor & TA Team

4

Student Introductions

5

Part 1: Course Orientation (45 mins)

6

Welcome to Design and Analysis of Algorithms

7

Syllabus Highlights

8

Academic Integrity & AI

9

Part 2: What is an Algorithm?

10

Definition

11

The Sorting Problem

12

Example: Insertion Sort (Logical)

Input: sequence of n numbers 
Output: permutation  such that a'1 <= a'2 <= ... <= a'n

1. Start with second element.
2. Compare with previous elements.
3. Shift elements greater than key to the right.
4. Insert key in correct position.
13

Correctness vs. Efficiency

14

Correctness

15

Efficiency

16

Java Example: Linear Search

public static int linearSearch(int[] arr, int target) {
    for (int i = 0; i < arr.length; i++) {
        if (arr[i] == target) return i;
    }
    return -1;
}
17

Analyzing Linear Search

18

Math Review

19

Logarithms

20

Series & Summations

21

Floors and Ceilings

22

Common Pitfalls & Anti-Patterns

23

Watch Out For...

24

Interactive Practice

25

Activity 1: Insertion Sort Trace

26

Solution 1

27

Activity 2: Pseudocode Translation

28

Solution 2

min = A[0]
for i = 1 to n:
    if A[i] < min:
        min = A[i]
return min
29

Interactive: Insertion Sort

30

Interactive: Linear Search

31

Interactive: Why Efficiency Matters

32

Lecture Summary

33

Supplementary Resources