Computer Science 332
Analysis of Algorithms

Dickinson College
Spring Semester 2003
Grant Braught

General Course Information
Course Schedule
Each date links to the slides for that day's class.
Note that the slides may only be downloaded from locations on campus.

1/21/03 1.1
• Exercises 1.1: #4, #5.
• Exercises 1.2: #2, #3.
• Give an algorithm in pseudo code that accepts two arrays of integers as input and produces as output a new array containing all of the elements that are common to the two input arrays. (see step 3 on p. 6 of the text.)
• 1/24/03 1.2, 1.3
• Exercises 1.3: #1(b,c), #3, #6(a), #7.
• For #1(b), justify your answer by giving a list that demonstrates that the algorithms is (or is not) stable. For #1(c), justify your answer. For #3, give pseudo code for your algorithm and use array notation to access an individual character in a string. For #6(a), give two alternative criterion.
• 1/28/03 1.4
• Exercises 1.4: #1, #3, #4, #10.
• Project #1 - A Graph ADT (Due: 2/25/03)
• 1/31/03 2.1, 2.2 (pp. 52-55)
• Exercises 2.1: #1, #5(a,c), #6.
• For #5(a) you might want to review the process for converting a decimal number to binary. For #5(c), you'll need the answer to #5(b) which is: `floor(log10n)+1`.
• Prove `Big-O` bounds for the following functions:
a) `5*n2+100*n*log2n+14*n+3`
b) `0.01*2n+54321*n2+3745`
• Prove `Big-Omega` bounds for the above functions.
• Prove `Big-Theta` bounds for the above functions.
• 2/4/032.2 (pp. 56-59), 2.3
• Exercises 2.2: #5, #7(a).
• Exercises 2.3: #2(a,c), #4(b,c,d), #6(b,c,d).
• For #4(b) and #6(b) setup and solve a summation. For #4(d) and #6(d) give asymptotic bounds.
• 2/7/03ReviewRework HW from 2/4/03
2/11/032.4
• Exercises 2.4: #1(a,b,c), #3, #4(b).
• For #1(a,b) provide an inductive proof that your expression for the ith iteration is correct. You may omit this proof for the remaining problems.
• 2/14/033.1, 3.3(pp. 107-108) (NOW DUE 2/25/03)
• Exercises 2.4 #1(d,e).
• Exercises 3.1 #1(a), #4(a).
• Exercises 3.3 #1.
• For 2.4 #1(d,e), you do not need to give an inductive proof that your expression for the ith iteration is correct.
• For #3.1 #4(a), Give pseudo code for your algorithm assuming that you may only perform + and * operations. (i.e. there is no way to find x^n in one step.)
• For 3.3 #1, describe your algorithm and state its efficency class. It is not required that you give pseudo-code for your algorithm.
• 2/18/03Snow Day!Snow Day!
2/21/03Midterm Exam #1 - Chapters 1-2
2/25/033.2, 3.3, 3.4
• Exercises 3.2 #6, #8.
• Exercises 3.3 #5, #6, #7.
• Exercises 3.4 #1
• For 3.3 #6, give pseudo code for your algorithm using syntax similar to that used on p. 107.
• 2/28/034.1
• Exercises 4.1 #3, #5, #6, #10
• For #3(b), just give a bound on T(n) using the Master Theorem.
• For #5, just give bounds on T(n) using the Master Theorem.
• For #6, give a figure similar to Fig. 4.2 in the text.
• For #10, just describe your algorithm and how it fits the divide and conquer model. You do not need to give pseudo code.
• 3/4/034.2, 4.5
• Exercises 4.2 #1, #8, #10
• For #1, give a figure similar to Fig. 4.3(b) in the text.
• For #8, Give a bound on T(n) for your algorithm.
• 3/7/035.1, 5.2
• Exercises 5.1 #1
• Exercises 5.2 #1(b), #4, #6(a)(b)
• Project #2 (Due 4/8/03)
• For 5.1 #1, Explain your algorithm and which type of decrease and conquer is uses. Pseduo code is not necessary. Setup and solve the recurrence for your algorithm.
• For 5.2 #6(b), The answer is no. Give a graph where BFS finds the cycle first and one where DFS finds the cycle first.
• 3/11/035.4
• Exercises 5.4, #1, #2(a)(b), #5, #6, #9(b)
• For #2 and #5 use a format similar to the examples in the text.
• 3/14/035.5, 5.6
• Exercises 5.5, #1
• Exercises 5.6 #1, #10
• For 5.5 #1, Give pseudo-code for your algorithm. Setup and solve a recurrence to deterimine your algorithm's time efficiency.
• For #10, Be sure your algorithm is a decrease and conquer algorithm. Describe your algorithm, pseudo-code is not necessary. Give a O bound for your algorithm.
• Spring Break
3/25/03 6.1, 6.3
• Exercises 6.1 #2, #6, #7, #9
• For #2(a) and 9, give pseudo-code for your algorithm assuming the existence of a `Sort(A)` routine that sorts the array A in O(n lg n) time.
• For #7, explain your algorithm, pseudo-code is not necessary. For both (a) and (b), explain why you chose to use (or not to use) presorting.
• 3/28/03 6.3, 6.5 (NOT COLLECTED)
• Exercises 6.3 #4(a)(b), #5
• Exercises 6.6 #2, #5
• For 6.3 #5(a), You must describe your algorithm but it is not necessary to give pseudo-code. For #5(b), explain your answer.
• 4/1/03Midterm Exam #2 - Chapters 3-6.
4/4/03 7.1,7.2
• Exercises 7.1 #1, #6
• Exercises 7.2 #4
• Give an algorithm for finding the ith digit of an integer X. Do not convert the integer to a string. HINT: Use log10X.
• Give best and worst case asymptotic bounds for Horspool's algorithm. Explain your bounds.
• For 7.1 #6, assume that the only way to change an array element is by swapping it with another array element. I.e. you cannot overwrite an element with a new one. HINT: Thing about partitioning.
• 4/8/03 9.1
• Exercises 9.1 #3
• For #3(b) give a correctness proof of your algorihtm.
• 4/11/03 9.1,9.2
• Exercises 9.1 #6, #8, #10
• 4/15/03 9.2
• Exercises 9.2 #1, #4, #5, #7
• 4/18/03 10.1,10.3
• Exercises 10.1 #2, #9
• Exercises 10.3 #7, #9, #10
• 4/22/03
Quick Hull
Topological Sort
4.6, 5.3 Student Presentations
• Exercises 4.6 #7, #8, #9
• Exercises 5.3 #1, #7
• 4/25/03No Class
4/29/03
Boyer-Moore
7.2, 7.4 Student Presentations
• Exercises 7.2 #7, #8, #9(b)
• Exercises 7.4 #2, #3, #4
• 5/2/03
Dijkstra's Algorithm
9.3, 9.4 Student Presentations
• Exercises 9.3 #1, #2, #3, #7
• Exercises 9.4 #1, #4, #10
• 5/12/03Final Exam 2:00pm