CS 1501 Algorithms and Data Structures 2

Spring 2020-2021

 

Contact Information

Instructor

 

 

Office Hours

Sherif Khattab, 6307 SENSQ

(412) 624-8438

skhattab@cs.pitt.edu

MW: 13:00-14:30

TH: 9:00-10:30 and 13:00-14:00

F: by appointment

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

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

TA

 

 

 

Office Hours

 

Sanchayan Sarkar

sanchveda@cs.pitt.edu

Norhan Abbas (Grader)

norhan.abbas@pitt.edu

 

M,T,W: 10:30-12:30

 

 

Tu: 14:00- 16:00

Th: 18:00- 20:00

F: 8:00- 10:00

Please find the Zoom links for TA office hours on Canvas.

Lectures

 

Section 1050: MW 9:25-10:40 @ 316 Information Sciences Build and Zoom
Section 1245: MW 15:25-16:40 @ 316 Information Sciences Build and Zoom (Please find the Zoom link on Canvas)

Recitations

25877 (1050): Friday 11:05-11:55 @ Zoom
25878 (1050: Friday 15:25-16:15 @ Zoom

25895 (1245): Friday 12:10-13:00 @ Zoom

25896 (1245): Friday 14:20-15:10 @ Zoom

(Please find the Zoom links in Canvas)

Student Feedback

Please send us your anonymous feedback

Top Hat Join Code

905022

 

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

 

Textbooks

 

 

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

ISBN-13: 9780321573513 (Available online via Pitt's library)

 

F. M. Carrano and T. M. Henry, Data Structures and Abstractions with Java (5th Ed.)
ISBN-10: 0134831691 (Available at Bevier Engineering Library Reserve Desk; QA76.9.D33 C37 2019)

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 905022.

Important Dates (Tentative)

 

Midterm Exam

W 3/3 at regular class time

Final Exam

TBD

 

 

 

 

 

 

Weekly Schedule (Tentative)

Assignment #

Out on

Due on @11:59pm

1

F 1/29

F 2/19

2

F 2/19

M 3/8

3

M 3/8

M 3/22

4

M 3/22

F 4/9

5

F 4/9

F 4/23

 

 

Week

Topic

Reading

Announcements

Wk 1 (1/19-1/22)

Intro. Material; Course Policies and Goals

 

Converting algorithms to programs; comparing algorithm implementations; algorithm analysis

Handout, Notes

 

Sedgewick Section 1.4

 

Wk 2 (1/25-1/29)

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

 

ADT Tree: Concepts, binary tree (full, complete), traversals (pre, in, post, level orders), tree implementation (multiple interfaces), binary nodes, binary tree implementation

Notes

Wikipedia

 

Carrano Chapter 23,24

Assignment 1 out on 1/29

Wk 3 (2/1-2/5)

Binary Search Tree: Implementation using binary nodes (adding, removing nodes) and algorithm analysis (run-time)

 

Carrano Chapter 25

Spring Term add/drop period ends on 2/5

Wk 4 (2/8-2/12)

Self-balancing trees

 

stack instead of recursion, iterator

 

Symbol Table ADT: array, linked-list, binary search tree

 

Notes

Wk 5 (2/15-2/19)

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

 

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

Notes

Sedgewick Sec. 3.1-3.2

 

Notes

Sedgewick Sec. 5.2

Assignment 1 due on 2/19 @ 11:59pm

Assignment 2 out on 2/19

Wk 6 (2/22-2/26)

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

 

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

 

Tu: Student Self-Care Day (no classes)

Notes

Sedgewick Sec. 5.5

 

 

 

 

 

 

 

Wk 7 (3/1-3/5)

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

 

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

 

Midterm exam

Notes

Sedgewick Section 4.1

 

 

 

Review for the midterm

 

Midterm exam on Wednesday 3/3

Wk 8 (3/8-3/12)

Connected components

 

Articulation points and biconnected components

 

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

Notes

Sedgewick Section 4.1

 

 

Notes

Sedgewick Section 4.3

Assignment 2 due on 3/8 @ 11:59pm

Assignment 3 out on 3/8

 

Wk 9 (3/15-3/19)

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

 

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

Notes

Sedgewick Section 4.3

 

Sedgewick Section 2.4

 

Wk 10 (3/22-3/26)

Brief discussion of Kruskal's MST algorithm

 

W: Student Self-Care Day (no classes)

Notes

Sedgewick Section 4.3

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

Assignment 4 out on 3/22

Wk 11 (3/29-4/2)

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

 

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)

Sedgewick Section 4.4

 

 

Notes

Sedgewick pp. 886-902

Wk 12 (4/5-4/9)

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)

 

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

 

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)

See Notes for references

 

 

 

See Notes for references

 

 

See Notes for references

 

 

Notes

See online references in notes

 

 

 

Notes

See online references in notes

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

Assignment 5 out on 4/9

 

Wk 13 (4/12-4/16)

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

 

 

 

 

 

 

 

 

Wk 14 (4/219-4/23)

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

Finals Week (4/25-5/1)

Final Exam

Prepare for the final

Final exam TBD

 

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.