CS 415, Section 001 Sonoma State University Fall, 2022
 
Algorithm Analysis
Instructor: Henry M. Walker

Lecturer, Sonoma State University
Professor Emeritus of Computer Science and Mathematics, Grinnell College

Although much of this course is well developed, some details can be expected to evolve as the semester progresses.
Any changes in course details will be announced promptly during class.

Tentative Class Schedule

Key: * = forthcoming

Tuesday Thursday
August 23
Getting Started
  • Start of classes
  • Introductions
  • Quick Course Overview
  • Home Page / Syllabus / Schedule
  • class format and expectations
  • Clicker set up
  • Status Check—where are we really?

Introduction to Algorithmic Analysis
  • Getting Started
  • Straight Selection Sort

Reading:
  • Levitin: Chapter 1: Introduction to Algorithms
    • Algorithmic Problem Solving
    • Problem types
    • Fundamental Data Structures
August 25
Functions, Growth Rates, Most Significant Terms
  • Graphs of common functions
  • Function sizes for large input values
  • O-notation, Ω-notation, Θ-notation

Examples of Algorithmic Analysis
Reading:
  • Levitin: Chapter 2: Analysis Fundamentals
    • 2.1 The Analysis Framework
    • 2.2 Asymptotic Notations: O-notation, Ω-notation, Θ-notation
    • 2.3 Analysis of nonrecursive algorithms

Worksheet on Analysis of Non-recursive Algorithms
[Due in paper form at start of class, Thursday, September 1]
August 30
Maintenance in the Software Life Cycle
Algorithmic Analysis via Experimentation
  • Simulations
  • Timing Algorithms

Reading
September 1
Recursive Algorithms
  • Recursive Algorithms
  • Recurrence Relations
  • Solving [some] Recurrence Relations

Reading
  • Levitin: Recursion: Relations and Algorithms
    • Appendix B: Recursive algorithms and recurrence relations
    • 2.4 Analysis of recursive algorithms
    • 2.5 Example: the nth Fibonacci Number

In-class Quiz

Worksheet on Analysis of Non-recursive Algorithms, Recursive Relations, and Program Format
[Due in paper form at start of class, Thursday, September 8]
September 6
Analysis of Recursive Algorithms
  • Identifying Several Recursive Patterns
  • The Master Theorem
  • Examples (e.g., Selection and Permutation Sorts, Sequential Search)

Reading
  • Levitin: Chapter 2: Recursive Algorithms and Analysis
    • 2.4 Analysis of recursive algorithms
    • 2.5 Example: the nth Fibonacci Number
September 8
Decrease and Conquer
  • Linear Search
  • Insertion Sort

Introduction to Assertions
  • Pre- and Post-Conditions
  • the assert statement in C and C++
  • Checking assertions with conditionals and functions

Readings:
Worksheet on Recursive Algorithms, Insertion Sort, and Assertions
[Due in paper form at start of class, Thursday, September 15]
September 13
Graphs and Internal Representations
  • Graphs
    • Storage of vertex information
    • Storage of edges using adjacency matrices
    • Storage of edges using adjacency lists
    • Breadth-first and Depth-first Searches
  • Efficiency

Loop Invariants: singly-nested loops
  • Assertions for loops
  • Example: Binary Search with Variations
  • Example: Reversing a List

Reading:
September 15
Loop Invariants with Nested Loops
  • Applications of Loop Invariants
    • Straight Selection Sort
    • Insertion Sort

In-class Quiz

Worksheet on Graph Basics and Invariants for Singly-nested Loops
[Due in paper form at start of class, Thursday, September 22]
September 20
Loop Invariants/Divide and Conquer Algorithms
  • Quicksort and Partition Procedure
  • Other applications of loop invariants

Graphs and Topological Sorting
  • Topological sorting
  • Efficiency

Readings:
  • Reading on Quicksort
  • Levitin:
    • 4.2 Topological sorting
    • 5.2 Quicksort, Partition, and other applications of loop invariants
September 22
Reflections on Topics to Date
  • Preliminary Topic List
    • Algorithmic Analysis, Big-O, Big-Θ, Big-Ω
    • Some Algorithmic Patterns
    • Basics of Graphs
    • Loop Invariants for Binary Search and Partition
    • Quicksort, Improved Quicksort, and Analysis

Worksheet/Lab on Topological Sorting, Partition, and Quicksort
September 27
Time to Catch Up
September 29
Test 1
October 4
Notes on Solutions for Test 1

Brute Force and Exhaustive Search
  • Examining All Possibilities
    • Linear Search
    • Printing elements on a linked list
      • in order
      • in reverse order
    • Permutation sort
    • Traveling Salesperson Problem
  • 3.2 Sequential Search
  • 3.4 Exhaustive Search

Divide-and-Conquer
  • Merge Sort

Readings:
October 6 Transform and Conquer
  • Heaps
    • Heap Abstract Data Type
    • Array Implementation

Readings:
  • Levitin:
    • 6.4 Heaps

Worksheet/Lab on Brute Force Algorithms, Merge Sort, and Heaps
October 11
Transform-and-Conquer
  • Heap Sort

Algebraic Manipulation for Efficiency
  • Horner's Rule

Reading
  • Levitin:
    • 6.4 Heaps and Heap Sort
    • 6.5 Horner's Rule
October 13
More Algebra for Efficiency
  • Binary Exponentiation

Reading
  • Levitin:
    • 6.5 Binary Exponentiation

In-class Quiz

Worksheet/Lab on Sorting and on Algebraic Manipulation for Efficiency
October 18
Hashing
  • Open Hashing (Separate Chaining)

Hashing
  • Closed Hashing (Open Addressing)

Reading:
  • Levitin:
    • 7.3 Hashing
October 20
Hashing
  • Efficiency Analysis for Hash Tables

Space and Time Trade-offs: Dynamic Programming
  • Approach for Dynamic Programming
  • Example: Computing nth Term of the Fibonacci Sequence
  • Example: Computing Combinations: n choose k

Reading:
  • Levitin:
    • 7.3 Hashing
    • 8.1 Dynamic Programming with Example

Lab on Hashing and Dynamic Programming
October 25
Numeric Data Representation
  • Accuracy
  • Overflow and underflow
  • Non-associativity for Floating-point numbers

Some Consequences of Numeric Data Representation
  • Writing Boolean expressions (e.g., in conditional statements, loops)

Reading:
October 27
More Consequences of Numeric Data Representation
  • Finding middle elements within array segments
  • Accumulating floating-point error in loops
Reading:
In-class Quiz

Lab on Consequences of Numeric Representation
[Lab Due Tuesday, November 8]
November 1
Time to catch up
November 3
Test 2
(November 3)
November 8
Notes from solutions to Test 2

Greedy Techniques
  • Minimum-cost spanning tree
  • Single-source shortest paths (Dijkstra's Algorithm)

Reading:
  • Levitin:
    • 9.1 Prim's algorithm (minimum cost spanning tree)
    • 9.3 Dijkstra's algorithm (single-source shortest paths)
November 10
Greedy Techniques
  • Huffman trees and codes
  • Limitations of Greedy Techniques (e.g., hill climbing)

Reading:
  • Levitin:
    • 9.4 Huffman trees and codes

Worksheet on Greedy Algorithms

November 15
An Algorithm with Runtime Θ(n3)
  • An Optimal Binary Search Tree
  • Connection with Dynamic Programming

Reading:
  • Levitin:
    • 8.3 Optimal Binary Search Trees
November 17 Limitations of Algorithm Power
  • Class P Problems
  • Class NP Problems
  • P NP, but does P = NP?

Reading:
  • Levitin:
    • 11.1 Lower bound arguments
    • 11.2 Decision trees
    • 11.3 P, NP, and NP-complete problems

In-class Quiz

Worksheet on Optimal Binary Search Trees and Classes P and NP

November 22
Classes P and NP
  • Consequences of the P = NP Question
  • NP Complete Problems

More Limitations of Computing
  • Halting problem
  • The Trapezoidal Rule

Reading:
  • Levitin:
    • 11.3 P, NP, and NP-complete problems
November 24
Thanksgiving Day: Thursday, November 24
November 29
More Limitations of Computing
  • Class P, NP and NP-Complete Problems
  • Additional Observations Concerning Numeric Error

Coping with Limitations of Algorithm Power
  • Branch-and-bound
  • Approximation algorithms

Reading:
  • Levitin:
    • 12.1 Backtracking
    • 12.2 Branch-and-bound
    • 12.3 Approximation algoritms
December 1
Coping with Limitations of Algorithm Power
  • Bisection method
  • Newton's method
  • RSA Encryption

Reading:
In-class Quiz

Worksheet on Coping with Limitations of Computing
December 6
Time to catch up
  • RSA Encyption
December 8
Last day of class: Thursday, December 8
December 13
Exam: Tuesday, December 13: 1:00-3:00
December 15  
created 22 June 2021
developed and refined Summer 2021
revised Summer 2022
Valid HTML 4.01! Valid CSS!
For more information, please contact Henry M. Walker at walker@cs.grinnell.edu.