|
Week
|
Class Meetings |
Readings & Homework
|
Handouts & Code
|
|
Week 13
Nov 17–Nov 21
|
- Nov 21: P, NP, NP-complete [L 11.3]
Outline
- Nov 19: Decision trees [L 11.2]
Outline
- Nov 17: Limitations of algorithmic power [L Ch 11 intro];
lower-bound arguments [L 11.1]
Outline
|
- Nov 19: Read L 11.3.
- Nov 17: Read L 11.2.
|
stable_marriage.cpp [C++ source]
Stable marriage algorithm
|
|
Week 12
Nov 10–Nov 14
|
- Nov 14: The Stable Marriage Problem [L 10.4]
Outline
- Nov 12: Maximum bipartite matching [L 10.3]
Outline
- Nov 10: Iterative improvement [L Ch 10 intro];
maximum flow [L 10.2]
Outline
|
- Online Quiz 12—on
Canvas
Due 5 pm Sun, Nov 16
- Nov 14: Read L Ch 11 intro, 11.1.
- Nov 12: Read L 10.4.
- Nov 10: Read L 10.3.
- Assignment 6 (Huffman Codes)
Due 5 pm Tue, Nov 25
|
huffcode.zip [ZIP of C++ header/source] SKELETON
Skeleton files for Assignment 6, Exercise A
huffcode_test.cpp [C++ source]
Test program for class HuffCode
Used in Assignment 6, Exercise A
|
|
Week 11
Nov 3–Nov 7
|
|
- Online Quiz 11—on
Canvas
Due 5 pm Sun, Nov 9
- Nov 7: Read L Ch 10 intro, 10.2.
- Nov 5: Read L 9.4.
- Nov 3: Read L 9.3.
|
dijkstra.cpp [C++ source]
Dijkstra’s algorithm
Based on prim.cpp
kruskal.cpp [C++ source]
Kruskal’s algorithm
Based on prim.cpp
Requires unionfind.hpp
unionfind_main.cpp [C++ source]
Simple main program for class UnionFind
Requires unionfind.hpp
unionfind.hpp [C++ header]
Header for class UnionFind
Union-Find structure
There is no associated source file.
|
|
Week 10
Oct 27–Oct 31
|
- Oct 31: Greedy techniques [L Ch 9 intro];
spanning trees I: Prim’s algorithm [L 9.1]
Outline
- Oct 29: Knapsack problem & memory functions [L 8.2]
Outline
- Oct 27: Class canceled
|
|
prim.cpp [C++ source]
Prim’s algorithm
build_test2.cpp [C++ source]
Test program for function bridges
Large problems added
Used in Assignment 5, Exercise A
knapsack.cpp [C++ source]
Knapsack problem
fibo_dp_topdown.cpp [C++ source]
Computing Fibonacci numbers
Dynamic programming (top-down)
|
|
Week 9
Oct 20–Oct 24
|
|
- Online Quiz 9—on
Canvas
Due 5 pm Sun, Oct 26
- Oct 24: Read L 8.2.
- Oct 22: Read L Ch 8 intro, 8.1.
- Oct 20: Read L 7.4.
- Assignment 4 (Various)
Due 5 pm Tue, Oct 28
|
coinrow.cpp [C++ source]
Bottom-up dynamic programming example
fibo_dp_bottomup.cpp [C++ source]
Computing Fibonacci numbers
Dynamic programming (bottom-up)
use_hash.cpp [C++ source]
C++ Hash Table demo
|
|
Week 8
Oct 13–Oct 17
|
- Oct 17: Space-time trade-offs [L Ch 7 intro];
sorting by counting [L 7.1]
Outline
- Oct 15: Heaps & heap sort [L 6.4];
problem reduction [L 6.6]
Outline
- Oct 13: Balanced search trees [L 6.3]
Outline & Supplemental Notes
|
- Online Quiz 8—on
Canvas
Due 5 pm Sun, Oct 19
- Oct 17: Read L 7.3.
- Oct 15: Read L Ch 7 intro, 7.1.
- Oct 13: Read L 6.4, 6.6.
|
dist_count_sort.cpp [C++ source]
Distribution Counting Sort
comp_count_sort.cpp [C++ source]
Comparison Counting Sort
euclid.py [Python 3 source]
Euclid’s Algorithm: GCD & LCM
introsort.cpp [C++ source]
Introsort
Requires heap_algs.hpp
heap_algs.hpp [C++ header]
Header for Heap algorithms
There is no associated source file.
heap_sort.cpp [C++ source]
Heap Sort
Requires heap_algs.hpp
|
|
Week 7
Oct 6–Oct 10
|
- Oct 10: Midterm Exam
- Oct 8: Geometric problems (cont’d) [L 5.5];
Transform and Conquer [L Ch 6 intro];
presorting [L 6.1];
Outline
- Oct 6: Multiplication (cont’d) [L 5.4];
geometric problems [L 5.5]
Outline & Supplemental Notes
|
- Online Quiz 7—on
Canvas
Due 5 pm Sun, Oct 12
- Oct 10: Read L 6.3.
- Oct 6: Read L Ch 6 intro, 6.1.
|
closest_pair_dc.cpp [C++ source]
Closest-Pair, Divide and Conquer Solution
|
|
Week 6
Sep 29–Oct 3
|
|
|
- Midterm Exam Review Problems
bintree_traverse.cpp [C++ source]
Binary Tree traversals: preorder, inorder, postorder
quicksort.cpp [C++ source]
Hoare Partition & Quicksort
iterative_merge_sort.cpp [C++ source]
Iterative Merge Sort using random-access iterators
merge_sort.cpp [C++ source]
Merge Sort using iterators
- In-Class Worksheet 1: The Master Theorem—Solutions [PDF]
Worksheet distributed in class Mon, Sep 29
- In-Class Worksheet 1: The Master Theorem [PDF]
Worksheet distributed in class Mon, Sep 29
inversions_test.cpp [C++ source]
Test program for function template inversions
Used in Assignment 3, Exercise B
contigsum_test.cpp [C++ source]
Test program for function template contigSum
Used in Assignment 3, Exercise A
|
|
Week 5
Sep 22–Sep 26
|
|
- Online Quiz 5—on
Canvas
Due 5 pm Sun, Sep 28
- Sep 26: Read L Ch 5 intro, 5.1.
- Sep 24: Read L 4.5.
- Sep 22: Read L 4.4.
|
introselect.cpp [C++ source]
Introselect with Lomuto Partition
mom_select.cpp [C++ source]
Median-of-Medians Selection
quickselect.cpp [C++ source]
Quickselect with Lomuto Partition
rpmult.cpp [C++ source]
Russian peasant multiplication
binary_search.cpp [C++ source]
Binary Search using iterators
|
|
Week 4
Sep 15–Sep 19
|
|
|
topological_sort.cpp [C++ source]
Topological sort
Uses find-source algorithm
bridges_test.cpp [C++ source]
Test program for function bridges
Used in Assignment 2, Exercise A
Uses the “doctest” unit-testing framework, version 2
Requires doctest.h, bridges.hpp, bridges.cpp
insertion_sort_vector_recurse.cpp [C++ source]
Insertion Sort on a vector, recursive
- Coding Standards
graph_traverse.cpp [C++ source]
Graph traversals: DFS & BFS
|
|
Week 3
Sep 8–Sep 12
|
- Sep 12: Brute force for geometric problems [L 3.3]
Outline
- Sep 10: Algorithmic strategies, brute force, exhaustive search [L Ch 3 intro];
simple brute-force methods [L 3.1–3.2]
Outline & Supplemental Notes
- Sep 8: Analysis examples [L 2.5, Appendix B]
Outline
|
- Online Quiz 3—on
Canvas
Due 5 pm Sun, Sep 14
- Sep 12: Read L 3.4, 3.5.
- Sep 10: Read L 3.3.
- Sep 8: Read L Ch 3 intro, 3.1,
3.2 (skip string-matching material).
|
closest_pair_bf.cpp [C++ source]
Closest Pair, Brute Force solution
selection_sort_vector.cpp [C++ source]
Selection Sort on a vector
bubble_sort_vector.cpp [C++ source]
Bubble Sort on a vector
fibo_matrix.py [Python 3 source]
Computing Fibonacci numbers
Based on matrix product
fibo_iterate.py [Python 3 source]
Computing Fibonacci numbers
Iterative
fibo_recurse.cpp [C++ source]
Computing Fibonacci numbers
Recursive (return 2, with wrapper)
fibo_iterate.cpp [C++ source]
Computing Fibonacci numbers
Iterative
fibo_recurse_slow.cpp [C++ source]
Computing Fibonacci numbers
Slow recursive method
|
|
Week 2
Sep 1–Sep 5
|
- Sep 5: Analyzing recursive algorithms [L 2.4, Appendix B]
Outline
- Sep 3: Analyzing nonrecursive algorithms [L 2.3, Appendix A]
Outline
- Sep 1: No class (Labor Day)
|
|
num_bits.cpp [C++ source]
Count bits in binary representation
factorial_recurse.cpp [C++ source]
Recursive computation of a factorial
insertion_sort_vector.cpp [C++ source]
Insertion Sort on a vector
|
|
Week 1
Aug 25–Aug 29
|
- Aug 29: Asymptotic notation [L 2.2]
Outline
- Aug 27: Framework for analysis of algorithms [L Ch 2 intro, 2.1]
Outline
- Aug 25: Course introduction;
introduction to analysis of algorithms [L Ch 1]
Outline
|
|
|