CS 1501 Algorithm Implementation (COE 1501)

Fall 2019

 

Contact Information

Instructor

 

 

 

Office Hours

Sherif Khattab, 6307 SENSQ

(412) 624-8438

skhattab@cs.pitt.edu

 

M: 10:30-11:30, 13:30-14:30, 17:00-18:00

T: 15:00-16:30

W: 10:30-14:30

Th: 13:00-16:30

 

Please schedule at: https://khattab.youcanbook.me/

TAs

 

 

Sections 1300/1305

 

 

 

Sections 1500/1530

 

Injung Kim, 6503 SENSQ

injungkim@cs.pitt.edu

OH: T 9:30-12:30

 

 

 

 

Mesut Erhan Unal, 6501 SENSQ

erhanunal@pitt.edu

OH: T 11:00-17:00

(Grader)

Joe Monaco (29731 and 29729)

jcm132@pitt.edu

OH: M: 13:00-15:00 (SENSQ 5710)

W: 12:00-13:00 (SENSQ 5806)

W: 14:00-16:00 (SENSQ 5710)

F: 13:00-15:00 (SENSQ 5806)

 

Marcus Dubreuil (29732 and 29730)

marcusdubreuil@pitt.edu

OH: TBD

Lectures

 

W 18:00-20:30 @ BENDM 226 (Section 1300 and 1305)

MW 15:00-16:15 @ OEH 300 (Section 1500 and 1530)

Recitations

26096 and 26099: F 13:00-13:50 @ SENSQ 5129

26097 and 26100: F 14:00-14:50 @ SENSQ 5129

29731 and 29729: M 11:00-11:50 @ SENSQ 5129

29732 and 29730: M 12:00-12:50 @ SENSQ 5129

Student Feedback

Please send us your anonymous feedback

Tophat join code

379911

 

Course Description

 

This course covers a broad range of the most commonly used algorithms. Some examples include algorithms for sorting, searching, encryption, compression and local search. The students will implement and test several algorithms. The course is programming intensive.

 

Prerequisites

 

CS 0441 and CS 0445

 

Textbook

 

 

Robert Sedgewick and Kevin Wayne, Algorithms, 4th Edition, Addison-Wesley, 2011.

ISBN-13: 9780321573513 (The book will be on reserve at the Engineering Library Reserve Disk http://pittcat.pitt.edu/cgi-bin/Pwebrecon.cgi?BBID=6473761)

 

(Recommended for W Section) Nicholas J. Higham, Handbook of Writing for the Mathematical Sciences, 2nd Edition, SIAM, 1998.

ISBN 0-89871-420-6 (The book will be on reserve at the Engineering Library Reserve Disk http://pittcat.pitt.edu/cgi-bin/Pwebrecon.cgi?BBID=66633)

Grading Policy

 

Midterm and Final exams (40%): 26% on higher grade and 14% on lower. Make-up exams can be scheduled well in advance.

 

Programming Assignments (40%): best four out of five assignments. Late submissions are allowed for up to two days with a 10% reduction per late day.

This must be your own individual work. Do not look at the solution of anyone (or even part of it), and do not let anyone else look at yours (or even part of it). You should figure out the solutions by yourself --- do not ask anyone how to solve the problem, and do not seek the answer from some other source.

 

Students are expected to have a backup disk (or storage somewhere) for every assignment they turn in. In this way, if there is any problem with the copy that is handed in the backup can be used for grading purposes.

 

The writing assignments for the W Section students will be substantial and will have significant weight. They will be announced on CourseWeb.

For the W Section students, the programming assignments will be worth 30% of the grade and the writing assignments will be worth 10%.

 

Recitation Participation (10%): Participation here means putting reasonable effort into solving the lab exercises.

 

Lecture Quizzes (10%): Mini-quizzes on Top Hat during each lecture. The join code for Top Hat is 379911.

 

For a first offense, a student caught collaborating or cheating in any way will receive a zero for the exam, homework, or project in question. In the event of a second offense, the student will receive an F for the course and may be subject to stronger action. They will be reported to the school following University procedures.

Note: Submissions that are alike in a substantive way (not due to coincidence) will be considered to be cheating by ALL involved parties. Please protect yourselves by only storing your files in private directories, and by retrieving all printouts promptly.

Important Dates

 

Midterm Exam

W 10/9 regular class time and location

Final Exam

W 12/11 18:00-19:50 (for the W 18:00 sections (1300 and 1305))

S 12/14 8:00-9:50 (for the MW 15:00 sections (1500 and 1530))

 

 

 

 

 

 

Weekly Schedule

Assignment #

Out on

Due on @11:59pm

1

F 9/13

M 9/30

2

M 9/30

F 10/18

3

F 10/18

M 11/4

4

M 11/4

F 11/22

5

F 11/22

F 12/6

 

 

Week

Topic

Reading

Announcements

Wk 1 (8/26-8/30)

Intro. Material; Course Policies and Goals

 

Converting algorithms to programs; comparing algorithm implementations; algorithm analysis

Handout, Notes

 

Sedgewick Section 1.4

 

Wk 2 (9/2-9/6)

No Monday class this week (Labor Day)

 

Intro. to exhaustive search; pruning, recursion and backtracking; 8-Queens and Boggle examples

 

Review of searching techniques (array, linked-list, binary search tree); Symbol Table ADT

 

 

Digital search trees (idea; comparison to binary search trees); radix search tries (idea; structure); multiway tries (idea; structure; implementation; run-time; overhead)

Notes

Wikipedia

 

Notes

Sedgewick Sec. 3.1-3.2

 

 

Sedgewick Sec. 5.2

Fall Term add/drop period ends on 9/6

Wk 3 (9/9-9/13)

de la Briandais trees (idea; structure, run-time)

 

 

Intro. to hashing (idea; collisions); collision resolution (open addressing vs. closed addressing)

Notes

Sedgewick Sec. 5.2

 

Sedgewick Sec. 3.4

Fall Term extended add/drop period ends on 9/13

Assignment 1 out on 9/13

Wk 4 (9/16-9/20)

Hashing: good vs. bad hash functions; hashing a string (idea; Horner's method); open addressing via linear probing; clustering; open addressing via double hashing; limitations of open addressing (deletion, resizing); closed addressing via separate chaining; other possible closed addressing schemes

 

Substring Matching: idea; brute force algorithm; worst and expected cases; KMP algorithm (idea and very brief discussion); Rabin-Karp Algorithm (idea; implementation; run-time; monte-carlo vs. las vegas)

 

Substring Matching: Boyer-Moore algorithm (idea; implementation; improvement in normal case; worst case); Overall comparison of algorithms

Notes

Sedgewick Sec. 3.4

 

 

 

 

 

 

Sedgewick Sec. 5.3

 

 

 

Notes

Sedgewick Sec. 5.3

Wk 5 (9/23-9/27)

Intro. to Compression: Lossy vs. Lossless Compression; Common compression programs

 

Huffman compression: block coding vs. variable length coding; prefix free codes; building the Huffman tree; examining / using Huffman compression; implementing Huffman compression; limitations of Huffman compression

Notes

Sedgewick Sec. 5.5

 

 

 

 

 

Wk 6 (9/30-10/4)

Intro. to LZW compression; idea; compressing; decompressing; adaptive nature of algorithm

 

LZW compression: special case for decompression; implementation issues

 

Comparison of compression algorithms; Limits on compression and information entropy

 

 

Integer multiplication (idea; run-time for ints; mutiplying integers with N bits); Gradeschool algorithm (idea and run-time)

 

Improving divide and conquer multiplication with Karatsuba algorithm (idea; details; run-time)

Notes

Sedgewick Sec. 5.5

 

 

 

 

 

See Notes for references

 

 

 

See Notes for references

 

 

Assignment 1 due on 9/30 @ 11:59pm

Assignment 2 out on 9/30

Wk 7 (10/7-10/11)

Exponentiation and powerMod (naive algorithm and run-time; improved algorithm using divide and conquer)

 

Greatest common divisor: inefficient vs. efficient implementation

 

Intro to Encryption; symmetric ciphers, key distribution problem

 

Midterm exam

See Notes for references

 

 

 

Notes

See online references in notes

 

 

 

Review for the midterm

Midterm exam on Wednesday 10/9

Wk 8 (10/14-10/18)

Public key encryption (idea; RSA as most common example; RSA algorithm)

 

 

RSA key generation and related issues (random prime generation, breaking RSA)

 

Uses of RSA (Digital Envelope / TLS, Digital Signatures)

 

 

Notes

See online references in notes

Assignment 2 due on 10/18 @ 11:59pm

Assignment 3 out on 10/18

 

Wk 9 (10/21-10/25)

Intro to Graphs (idea; definitions; vertices vs. edges)

 

Simple Graph Traversals (DFS; BFS) -- idea; algorithms; run-times

 

Connected components

 

Articulation points and biconnected components

Notes

Sedgewick Section 4.1

 

 

 

 

Wk 10 (10/28-11/1)

Intro. to weighted graphs, representing weighted graphs, unweighted spanning trees and shortest paths vs. weighted spanning trees and shortest paths

 

Prim's MST algorithm (idea; naive approach; Lazy version; Eager version)

Notes

Sedgewick Section 4.3

Wk 11 (11/4-11/8)

Brief discussion of Kruskal's MST algorithm

 

 

Priority Queues and Heap implementation; Indexable PQ implementation (needed for Eager Prim)

 

 

Dijkstra's Shortest Path algorithm (similarity to Eager Prim, difference in priority)

Notes

Sedgewick Section 4.3

 

Sedgewick Section 2.4

 

 

 

Sedgewick Section 4.4

Assignment 3 due on 11/4 @ 11:59pm

Assignment 4 out on 11/4

Wk 12 (11/11-11/15)

Network Flow (idea; definitions); Ford-Fulkerson approach to finding maximum flow (augmenting paths; residual graph; finding augmentin paths, backward Flow, Edmonds and Karp algorithm, BFS vs. PFS for augmenting paths)

Notes

Sedgewick pp. 886-902

 

Wk 13 (11/18-11/22)

Min-Cut vs. Max Flow

 

 

Unsolvable, Intractable and Polynomial problems

 

NP and NP-completeness; P vs. NP; showing NP completeness via reduction; approximating solutions to NP complete problems via heuristics; local search and 2-opt example for TSP

Notes

Sedgewick pp. 886-902

 

Notes

Sedgewick pp. 903-921

Assignment 4 due on 11/22 @ 11:59pm

Assignment 5 out on 11/22

Wk 14 (11/25-11/29)

Thanksgiving Recess - No classes

Wk 15 (12/2-12/6)

Dynamic Programming: Idea; "Bottom up" and "memoization"; Fibonacci example; Subset Sum problem (idea, branch and bound solution, dynamic programming solution); Knapsack problem (idea)

Notes, handouts

Assignment 5 due on 12/6 @ 11:59pm

Finals Week (12/9-12/13)

Final Exam

Prepare for

the final

Final exam on

W 12/11 18:00-19:50 (for Section 1300 and 1305, the W 18:00 sections) and

S 12/14 8:00-9:50 (for Section 1500 and 1530, the MW 15:00 sections)

 

Students with Disabilities

 

If you have a disability for which you are or may be requesting an accommodation, you are encouraged to contact both your instructor and Disability Resources and Services (DRS), 140 William Pitt Union, (412) 648-7890, drsrecep@pitt.edu, (412) 228-5347 for P3 ASL users, as early as possible in the term. DRS will verify your disability and determine reasonable accommodations for this course.

Academic Integrity

Students have the responsibility to be honest and to conduct themselves in an ethical manner while pursuing academic studies. Students have the right to be treated by faculty in a fair and conscientious manner in accordance with the ethical standards generally recognized within the academic community (as well as those recognized within the profession). Should a student be accused of a breach of academic integrity or have questions regarding faculty responsibilities, procedural safeguards including provisions of due process have been designed to protect student rights. These may be found in Guidelines on Academic Integrity: Academic Integrity Policy of the School of Computing and Information.

Religious Observances

In order to accommodate the observance of religious holidays, students should inform the instructor (by email, within the first two weeks of the term) of any such days which conflict with scheduled class activities.