## CISC 320 Introduction to Algorithms evolving summary page

Click
here for current class info below. Syllabus. Piazza site for discussion. UD Sakai site including gradebook

Course meeting time: MW 3:35-4:50, place: 108 Memorial Hall

Instructor: David Saunders, saunders@udel.edu, 302-831-6238,
Office hours 11:00am Monday and 10:00am Wednesday in 414 Smith Hall.
Other meeting times can be easily arranged by email (please suggest a time when you first contact me).

Teaching Assistant: Cagri Sahin, cagri.udel@gmail.com
Office hours 2:00-4:00pm in 201 Smith Hall.

Resources: Textbook homepage (The Algorithm Design Manual by Skienna)
Skiena's slides
The C++ Standard Template Library, STL Documentation at SGI.

## Lectures Synopsis, Spring, 2015

This page contains a brief summary of each class topic with links to the associated reading assignment, homework, and online materials referenced. This page morphs frequently, being updated at least weekly. You may need to reload it at each viewing to avoid being shown a stale version from your browser cache. Last updated May 19, 2015.

class 1, Mon, Feb 9

• prolog (hardware + software = machine) summation
• pragmas (syllabus: text, course organization, etc.)
• chapter 1 (robot tour)

class 2, Wed, Feb 11

• Homework 1 problem of the day: DM 1.29 (race horses)
• Reading assignment for today: DM Chapter 1.
• chapter 1 (finish robot tour, discuss actor schedule)
• Recursive objects, Divide and conquer strategies

class 3, Mon, Feb 16

• Homework 2 problem of the day: DM 1.5 (knapsack examples). Give (and explain) one (small) example that is a counterexample to all three strategies.
• Reading assignment for today: DM Chapter 2 through 2.5.
• RAM, Big-O, Θ Ω and their uses.

class 4, Wed, Feb 18

• Homework 3 problem of the day: DM 2.21 Explain your answers. Full credit if you do 5 parts correctly.
• Reading assignment for today: DM Chapter 3 through 3.4.
• Basic Data Structures (Guest lecture)

class 5, Mon, Feb 23

• Homework 4 problem of the day: Prove that a polynomial is codominant with its leading (highest degree) term.
• Reading assignment for today: DM Chapter 4 through 4.6.
• Dictionary API, Heaps and Heapsort.
• Two ways to do heapify.

class 6, Wed, Feb 25

• Homework 5 problem of the day: Design (and clearly explain) an algorithm to find the second largest element in an unsorted array. Your algorithm should use n + O(log(n)) comparisons of elements on an array of size n. You may use O(n) space as well. [Hint: think tournament]
• Reading assignment for today: DM Finish Chapter 3.
• Finish discussion of heapify.
• binary search trees: dictionary API operations average time is O(h), where h is the height of the root.
• balanced binary search trees: dictionary API operations worst case time is O(log(n)). 2,3,4-trees, RedBlack trees: Sedgewick slides

class 7, Mon, Mar 2

• Homework 6 problem of the day: 3-10 (first part only, using the best-fit heuristic).
[C++ solution using the STL set class.]
• Reading assignment for today: DM Chapter 5 through 5.6. (Eager to start on graphs, we'll come back to sorting later.)
• Graph representation, breadth first search, pseudocode.

class 8, Wed, Mar 4

• Homework 7 problem of the day: 5-5 (see section 5.7).
• Reading assignment for today: DM Chapter 5 through 5.9.
• Applications of breadth first search (single source distance, diameter, connected components)
• Depth first search, pseudocode.
• coding algorithms in C
• Homework 9 assigned, due Mar 11 Extra Credit: 5-11

class 9, Mon, Mar 9

• Homework 8 problem of the day: 5-18
• Reading assignment for today: DM 5.9 and 5.10.
• tree, back, forward, and cross edges with respect to BFS and DFS
• Entry and exit time stamps for DFS.
• Topological sort of DFS tree

class 10, Wed, Mar 11

• Homework 10 problem of the day: 5-2 (topological sort) (correction: edge H->F, NOT F->H in graph)
• Homework 9, extra credit is due if you are doing it (entirely optional).
• Topological sort of DAGs, reread 5.9 and 5.10
• Applications of depth first search (topological sorting, strongly connected components)
• triangle strips, reread.war stories 3.6 and 5.4
• tips on coding graph algorithms in C++ (if time permits)

class 11, Mon, Mar 16

• Homework 11 problem of the day: 5-26 (mother vertex)
• Reading assignment for today: DM 6.1 and 6.2.
• connectedness(strong and weak), components (strong and weak)
• MST: Kruskal's algorithm, Prim's algorithm

class 12, Wed, Mar 18

• Homework 12 problem of the day: (A) list the edges (pairs of cities) in the MST of this graph in the order that Prim's algorithm would add them to the tree, starting at Salt Lake City. (B) list the edges of the MST that Kruskal's algorithm would build for the same graph, in the order that Kruskal's algorithm would add them. For this hw, no further explanation is required.
• MST: correctness and cost for Kruskal's algorithm, Prim's algorithm
• midterm exam tips.

class 13, Mon, Mar 23

• Union-find ops are nearly constant time using union by weight and path compression (bottom of Kruskal implementation page).
• connectedness(strong and weak), components (strong and weak)
• quiz on Minimum Spanning Trees (MST). Preparation: solve as much as you can in the first 7 exercises on MST, 6-1 through 6-7. quiz with answer key
• review for midterm

class 14, Wed, Mar 25

• Midterm Exam

class 15, Mon, Apr 6

class 16, Wed, Apr 8

• Project discussion. pseudocode
• 2% quiz 2: questions. (14,15) (1) Graph terminology question. (2) Exercise 6-13 or Least common ancestor in tree given by parent array. (Least common ancestor of u,v: lowest node in tree that is on both path to root from u and path to root from v.)

class 17, Mon, Apr 13

• Homework problem of the day 16: The problem 2-SAT is like 3-SAT except that every clause has 2 atoms instead of 3 atoms. Give a polynomial time algorithm for 2-SAT.
• quiz question 17: DM 6-15 (prove or give counterexample)
• The satisfiability problem and it's special form 3SAT. Reading DM 9.4
• SSSP and APSP Reading DM 6.3
• Reading assignment for today: DM 6.4, 6.5, 6.6

class 18, Wed, Apr 15

class 19, Mon, Apr 20

• ACM Mentor program.
• Homework problem of the day plus 1 (questions 18, 19) here
• bipartite matching (application of network flows) Reading DM 6.5
• stable marriage problem Reading Wikipedia, class notes
• Another example of "design a graph, not an algorithm": Reduction of 3SAT to Vertex Cover. Reading DM 9.5.2

class 20, Wed, Apr 22

• Homework problem of the day plus 1 (questions 20, 21) here
• Search with backtracking, Reading DM chapter 7 through 7.3.
• Sudoku instances notes
• Backtracking Sudoku solver: othersudoku.c.
• The virtual search tree.
• "for all" vs "there exists": partition generator vs sudoku solver.
• Removing MAXV: othergraph.h, othergraph.c.

class 21, Mon, Apr 27

• Homework problem of the day (question 22): Modify othersudoku.c so that it prints "No solution" if there is, in fact, no solution for the given starting board configuration. You may assume the starting board has at least one free (unassigned) position.
• Heuristics in search, Reading DM chapter 7.4 and 7.5.
• Review of basic search framework. Subset and permutation searches. Variations on permutation construct_candidates
• Sample search problems: contest problems
• Further details TBA

class 22, Wed, Apr 29

• Homework problem(s) of the day: ACM programming contest problems. But nothing to turn in today.
• Further review of solutions to Monday's problem of the day. othersudoku-s.c now compiles and runs. It exemplifies 2 (of many) approaches.
• Programming project 2 (Searchin') assignment is available on Sakai.
• Review of ideas for solving problem F: tight knight. notes.
• Review of ideas for solving problem C: all things being equal. notes.
• Consideration of ideas for solving problem H: verti-words. notes.
• Heuristics in search, Reading review DM section 7.5, with emphasis on Simulated Annealing.

class 23, Mon, May 4

• Homework problem of the day (23): A weighted graph is planar if there is a way to assign a point (an (x,y) pair) to each vertex so that the Euclidean distance between the points is the weight of the edge. (Part a) Prove or give counterexample: No two edges cross in a planar graph Traveling Salesman solution (minimum weight cycle through all vertices). Reference: figure 7.8, also section 16.4. (Part b) give an example of a weighted graph that is not planar.
• Consideration of ideas for solving problem E: not sew difficult. notes. Etrial.c
• Applications of simulated annealing, finish on search, Reading review DM chapter7, particularly 7.5.4, 7.7.
• C and C++ input, stdinput.c

class 24, Wed, May 6

• Homework problem of the day: It'll be a quiz. We are starting one of the coolest topics in algorithm design, dynamic programming. Prepare by familiarizing yourself with the fibonacci section, 8.1, and the edit distance problem. Be sure you understand the code in section 8.2.1. The quiz question(s) will be designed to check that you understand the application of caching and dynamic programming to fib. For edit distance, it'll suffice to know the steps allowed (substitution, insertion, deletion) in the problem and are able to calculate the edit distance between small strings by hand. We will be covering the application of caching and dynamic programming to edit distance in class. This aspect will not be on the quiz.
• Dynamic programming, Reading DM chapter 8 particularly thru 8.3.
• An old chestnut: Fibonacci sequence. Maple "option remember", fib.c.
• Edit Distance: editDist.h, editDist.C
• Consideration of ideas for solving problem G: stealth. notes.
• Dynamic Programming summary.

class 25, Mon, May 11

• Homework problem of the day: As specified in last 3 hw assignments.
• Dynamic programming, Reading DM chapter 8 with emphasis on 8.3, 8.5, 8.7.
• Another classic DP problem: Longest increasing sequence.
• What happens to the DP strategy when the problem is really hard?

class 26, Wed, May 13

• Homework problem of the day: As specified in last 3 hw assignments.
• From one hard problem to another, Reading DM chapter 9 through 9.6 (we read 9.4 earlier).
• Notes on P, NP, NPComplete.

class 27, Mon, May 18

• Homework problem of the day: DM exercise 9-8.
• NP complete, tying it together: Cook's theorem. notes.
• Harder than NP: A hierarchy of complexity classes.
• From hard to impossible. The halting problem. halts.h halting.c paradox.c
• Course review. Review tips.
• An old final may be a useful review tool. No guarantees.

Final Exam, Wed, May 20

7-9pm in Memorial 108 (our classroom),