CS 1501 Algorithm Implementation

Fall 2020

 

Contact Information

Instructor

 

 

Office Hours

Sherif Khattab, 6307 SENSQ

(412) 624-8438

skhattab@cs.pitt.edu

TH: 1:00 pm-5:00 pm and by appointment

Zoom link: https://pitt.zoom.us/my/khattab

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

TA

 

 

 

Office Hours

 

Nannan Wen

naw66@pitt.edu

Jian Liu

jil296@pitt.edu

 

 

MF: 14:00-17:00

Zoom Meeting ID: 4321743304

Passcode: 20201501

 


W: 14:30-17:30

Zoom Meeting ID:

91840969455

 

Lectures

 

Section 1400: MW 11:05-12:20 @ 152 CHVRN and Zoom
Section 1150: MW 13:15-14:30 @ 120 LAWRN and Zoom

(Please find the Zoom link on Canvas)

Recitations

25811: Tuesday 16:30-17:20 @ Zoom
25814: Tuesday 17:30-18:20 @ Zoom

11162: Friday 10:00-10:50 @ Zoom

18076: Friday 12:10-13:00 @ Zoom

(Please find the Zoom link in Canvas)

Student Feedback

Please send us your anonymous feedback

Top Hat Join Code

141267

 

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.

 

The class has two main learning outcomes:

1.     To convert non-trivial algorithms into programs and

2.     To analyze and compare run-times of algorithms

 

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 put on reserve at the Engineering Library Reserve Disk http://pittcat.pitt.edu/cgi-bin/Pwebrecon.cgi?BBID=6473761)

Grading Policy

 

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.

 

Midterm and Final exams (20%): 12% on higher grade and 8% on lower. Make-up exams can be scheduled well in advance. The exams are remote and non-cumulative.


Homework assignments (20%): Twelve homework assignments worth 2% each. The lowest two homework assignments will be dropped.


Recitation Participation
(10%): Ten lab exercises worth 1% each.

 

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

Important Dates

 

Midterm Exam

M 10/5 at regular class time (remote)

Final Exam

For MW 11:05 section: W 12/2 14:00-15:50
For MW 13:15 section: W 12/2 8:00-9:50
(remote)

 

 

 

 

Weekly Schedule (Tentative)

Assignment #

Out on

Due on @11:59pm

1

F 9/11

M 9/28

2

M 9/28

F 10/16

3

F 10/16

M 11/2

4

M 11/2

F 11/20

5

F 11/20

S 12/6

 

 

Week

Topic

Reading

Announcements

Wk 1 (8/24-8/28)

Intro. Material; Course Policies and Goals

 

Converting algorithms to programs; comparing algorithm implementations; algorithm analysis

Handout, Notes

 

Sedgewick Section 1.4

 

Wk 2 (8/31-9/4)

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/4

Wk 3 (9/7-9/11)

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

Assignment 1 out on 9/11

Wk 4 (9/14-9/18)

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/21-9/25)

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/28-10/2)

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/28 @ 11:59pm

Assignment 2 out on 9/28

Wk 7 (10/5-10/9)

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 Monday 10/5

Wk 8 (10/12-10/16)

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)

 

W: Student Self-Care Day (no classes)

 

 

Notes

See online references in notes

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

Assignment 3 out on 10/16

 

Wk 9 (10/19-10/23)

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/26-10/30)

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/2-11/6)

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/2 @ 11:59pm

Assignment 4 out on 11/2

Wk 12 (11/9-11/13)

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/16-11/20)

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

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

Notes

Sedgewick pp. 886-902

 

Notes

Sedgewick pp. 903-921

 

 

 

 

 

Notes, handouts

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

Assignment 5 out on 11/20

 

 

Finals Week

(11/30-12/3)

Final Exam

Prepare for

the final

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

Final exam will be remote.

For MW 11:05 section: W 12/2 14:00-15:50
For MW 13:15 section: W 12/2 8:00-9:50

 

Communication Policy

 

 

There are many ways to communicate with the teaching team. Please reach out to us as early as possible and as frequently as possible. You can reach us on:

·      Piazza

·      Canvas Messages

·      Email

Please expect a response within 72 hours.

 

COVID-19 Statement

 

I would like to emphasize that my number one concern is your safety and health, both physical and mental.  My goal is for each and every one of you to succeed in the course. I am here to support you and I will remain understanding and flexible given the challenges that we are all facing together. The lectures and recitations will be recorded, and the recorded sessions include your participation. The recorded sessions will be made available through Canvas and only to this term's class. Although I expect you to attend the live lectures and recitations, attendance is not taken. The Tophat questions that are offered during the live lectures will also be assigned as homework. 

 

Minimum Technology Requirements

Basic computer hardware that includes camera and microphone for the Zoom meetings. Basic software (e.g., Microsoft Suite, Canvas, Panopto, Top Hat, Zoom, Gradescope, Piazza, PuTTY, WinSCP or FileZilla, a text editor (e.g., Atom, Sublime, VS Code, Notepad++, Brackets, etc.).

 

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


All assignment submissions must be the sole work of each individual student. Students may not read or copy another student's solutions or share their own solutions with other students. Students may not review solutions from students who have taken the course in previous years. Submissions that are substantively similar will be considered cheating by all students involved, and as such, students must be mindful not to post their code publicly. The use of books and online resources is allowed, but must be credited in submissions, and material may not be copied verbatim. Any use of electronics or other resources during an examination will be considered cheating. If you have any doubts about whether a particular action may be construed as cheating, ask the instructor for clarification before you do it. The instructor will make the final determination of what is considered cheating. Cheating in this course will result in a grade of F for the course and may be subject to further disciplinary action.
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.

Pay attention to the following examples of cheating, which include:

§      Sharing code: either by copying, retyping, looking at, or supplying a copy of a file from this or a previous semester.

§      Describing code: Verbal description of code from one person to another.

§      Coaching: Helping your friend to write a lab, line by line.

§      Copying: Copying code from the Web or another student. You are only allowed to use code that we provide you.

§      Searching: Searching the Web for solutions or for any advice on the lab.

Cheating is also looking at other students’ code or allowing others to look at yours. This includes one person looking at code and describing it to another. Be sure to store your work in protected directories (e.g., under the private folder on your AFS space on the department servers), and log off when you leave a remote server, to prevent others from copying your work without your explicit assistance.

You may find it useful to know what is not cheating:

§      Clarifying ambiguities or vague points in class handouts, lectures, or textbooks.

§      Helping others use the computer systems, networks, compilers, debuggers, profilers, or other system facilities.

§      Helping others with high-level design issues only, but algorithm/coding and other such details are not ``high-level design issues''.

§      Helping others with high-level (not code-based) debugging.

§      Using code from the skeleton/package provided in class is always OK.

For a first offense, a student caught collaborating or cheating in any way will receive a zero for the exam, homework, lab, 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. 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.

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.

Diversity and Inclusion Statement

I consider this classroom to be a place where you will be treated with respect, and I welcome individuals of all ages, backgrounds, beliefs, ethnicities, genders, gender identities, gender expressions, national origins, religious affiliations, sexual orientations, ability – and other visible and nonvisible differences. All members of this class are expected to contribute to a respectful, welcoming and inclusive environment for every other member of the class. (American Society for Engineering Education)

 

Copyright Statement

 

These materials may be protected by copyright. United States copyright law, 17 USC section 101, et seq., in addition to University policy and procedures, prohibit unauthorized duplication or retransmission of course materials. See Library of Congress Copyright Office and the University Copyright Policy.

 


Classroom Recording

 

 

To ensure the free and open discussion of ideas, students may not record classroom lectures, discussion and/or activities without the advance written permission of the instructor, and any such recording properly approved in advance can be used solely for the student’s own private use.