CS 415, Section 001 Sonoma State University Spring, 2023
 
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

Tuesday Thursday
January 24
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
January 26
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

Assignment on Analysis of Non-recursive Algorithms
Due: Thursday, February 2
January 31
Maintenance in the Software Life Cycle
Algorithmic Analysis via Experimentation
  • Simulations
  • Timing Algorithms

Reading
February 2
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 #1

Assignment on Analysis of Non-recursive Algorithms, Recursive Relations, and Program Format
Due: Tuesday, February 14
February 7
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
February 9
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:
Assignment on Recursive Algorithms, Insertion Sort, and Assertions
Due: Thursday, February 16
February 14
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:
February 16
Loop Invariants with Nested Loops
  • Applications of Loop Invariants
    • Straight Selection Sort
    • Insertion Sort

In-class Quiz #2

Assignment on Graph Basics and Invariants for Singly-nested Loops
Due: Tuesday, February 28
February 21
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
February 23
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

Assignment on Topological Sorting, Partition, and Quicksort
Due: Tuesday, March 7
February 28
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:
March 2 Transform and Conquer
  • Heaps
    • Heap Abstract Data Type
    • Array Implementation

Readings:
  • Levitin:
    • 6.4 Heaps

In-class Quiz #3
Assignment on Brute Force Algorithms, Merge Sort, and Heaps
Due: Tuesday, March 14
March 7
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
March 9
Time to Catch Up
Assignment on Sorting and Using Algebra to Improve Efficiency
Due: Thursday, March 30
March 14
Test 1

(March 14)
March 16
Films and Responses: Outside Class Activity
  • Comparison of Sorting Algorithms
  • RSA Encryption
  • Challenges of Big Data and Computing

    Assignment involving Films
    Email responses by Tuesday, March 28
  • March 21
    Spring Break (Tuesday, March 21)
    March 23
    Spring Break (Thursday, March 23)
    March 28
    Notes from solutions to Test 1

    More Algebra for Efficiency
    • Binary Exponentiation

    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:
      • 6.5 Binary Exponentiation
      • 8.1 Dynamic Programming with Example
    March 30
    Hashing
    • Open Hashing (Separate Chaining)

    Hashing
    • Closed Hashing (Open Addressing)

    Reading:
    • Levitin:
      • 7.3 Hashing

    Assignment on Binary Exponentiation, Dynamic Programming, and Hashing
    Due: Thursday, April 13
    April 4
    Hashing
    • Efficiency Analysis for Hash Tables

    Numeric Data Representation
    • Accuracy
    • Overflow and underflow
    • Non-associativity for Floating-point numbers

    Reading:
    April 6
    Some Consequences of Numeric Data Representation
    • Writing Boolean expressions (e.g., in conditional statements, loops)
    • Finding middle elements within array segments
    • Accumulating floating-point error in loops
    Reading:
    In-class Quiz #4
    Quiz Revision Due: Tuesday, April 18

    Assignment on Consequences of Numeric Representation
    Due: Tuesday, April 18
    April 11
    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)
    April 13
    Greedy Techniques
    • Huffman trees and codes
    • Limitations of Greedy Techniques (e.g., hill climbing)

    Reading:
    • Levitin:
      • 9.4 Huffman trees and codes

    Assignment on Greedy Algorithms
    Due: Tuesday, April 25
    April 18
    Time to catch up
    April 20
    Test 2
    April 25
    Notes from solutions to Test 2

    Introduction to Class P and NP
    April 27 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 #5

    Assignment on Classes P and NP
    Due: Tuesday, May 9
    May 2
    Classes P and NP
    • Consequences of the P = NP Question
    • NP Complete Problems

    More Limitations of Computing
    • Halting problem
    • The Trapezoidal Rule
    • Bisection method

    Reading:
    May 4
    More Limitations of Computing
    • Class P, NP and NP-Complete Problems
    • Additional Observations Concerning Numeric Error

    In-class Quiz #6
    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

    Assignment on Coping with Limitations of Computing
    Due: Thursday, May 11
    However, if this assignment is submitted on Tuesday, May 9, it will be graded and returned on Thursday, May 11.
    May 9
    Time to Catch Up
    May 11
    Last day of class: Thursday, May 11
    May 16
    Exam: Tuesday, May 16: 1:00-3:00
    May 18  
    created 22 June 2021
    developed and refined Summer 2021
    revised Summer 2022
    revised January 2023
    Valid HTML 4.01! Valid CSS!
    For more information, please contact Henry M. Walker at walker@cs.grinnell.edu.