CS 1501 - Algorithms and Data Structures 2

Spring 2024

 

Contact Information

Instructor

 

 

Office Hours

Sherif Khattab, 6307 SENSQ, Zoom room: https://pitt.zoom.us/my/khattab

(412) 624-8438

skhattab@cs.pitt.edu

 

MW: 11 am-noon; 1 pm-2 pm

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

TuTh: 11 am-noon

F: by email appointment

 

 

Lectures

MW 4:30 - 5:45 pm @ 232 Cathedral of Learning

 

TA

 

 

Office Hours

 

 

TA

 

 

Office Hours

 

 

 

 

TA

 

Office Hours

 

TBD

(Grader TA)

TBD

(Recitation TA for Th @ 10 am)

TBD

 

 

 

 

TBD

(Recitation TA for Th @ 11 am)

TBD

(Recitation TA for Th @ noon)

TBD

TBD

 

 

 

 

TBD

(Recitation TA for Th @ 3 pm)

TBD

(Recitation TA for Th @ 5 pm)

TBD

TBD

 

 

 

Recitations

30247: Thursday 10:00-10:50 @ SENSQ 5313

23385: Thursday 11:00-11:50 @ IS 411

27823: Thursday 12:00-12:50 @ IS 411

23384: Thursday 15:00-15:50 @ CL 139

27794: Thursday 17:00-17:50 @ IS 406

Student Feedback

Please send us your anonymous feedback

Canvas Course

https://canvas.pitt.edu/courses/241587

Top Hat Join Code

Please join using the Top Hat - New link inside Canvas

 

Course Description

 

This course covers a broad range of data structures and algorithms. Some examples include data structures and algorithms for searching and compression, graph data structures and algorithms, and dynamic programming. The students will implement and test several algorithms. The course is programming intensive using the Java programming language.

 

The class has two main learning outcomes:

1.     To convert non-trivial algorithms into programs

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 at Bevier Engineering Library Reserve Desk; QA76.9.A43 S429 2011)

 

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%): Five programming assignments in Java worth 8% each. Late submissions are allowed for up to two days with a 10% reduction per late day. After two days, the assignment grade is zero. The assignments will be handed out using Github Classroom and must be submitted on the Gradescope platform.

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 (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 (40%): 20% each. Make-up exams can be scheduled well in advance. The exams are in-person and non-cumulative.


Homework assignments
(6%): Twelve homework assignments worth 0.5% each. Late submissions are not accepted for homework assignments.


Recitation Lab assignments
(6%): Six lab exercises worth 1% each. Late submissions are not accepted for lab assignments.

 

Lecture Quizzes (8%): Mini quizzes on Top Hat during (almost) each lecture.

 

Please note that the grades posted on Canvas, especially the final letter grade, are tentative.

Important Dates (Tentative)

 

Midterm Exam

W 2/21 at regular class time

Final Exam

M 12/11 from 8-9:50 am

 

Programing Assignment #

Out on

Due on GradeScope @11:59pm

1

F 9/8

F 9/29

2

F 9/29

F 10/20

3

F 10/20

F 11/3

4

F 11/3

F 11/17

5

F 11/17

F 12/8

 

Homework Assignment #

Out on

Due on GradeScope @11:59pm

1

F 9/1

T 9/5

2

F 9/8

T 9/12

3

F 9/15

T 9/19

4

F 9/22

T 9/26

5

F 9/29

T 10/3

6

F 10/6

T 10/17

7

F 10/13

T 10/24

8

F 10/20

T 10/31

9

F 10/27

T 11/7

10

F 11/3

T 11/14

11

F 11/10

T 11/28

12

F 11/17

T 12/5

 

Lab Assignment #

Out on

Due on GradeScope @11:59pm

1

F 9/8

F 9/15

2

F 9/15

F 9/22

3

F 9/29

F 10/6

4

F 10/20

F 10/27

5

F 11/3

F 11/10

6

F 11/17

F 12/1

 

 

 

 

Weekly Schedule (Tentative)

 

 

Week

Topic

Reading

Recitation Schedule

Announcements

Wk 1

(1/8-1/12)

Course goals and policies; Intro. Material: converting algorithms to programs; comparing algorithm implementations; algorithm analysis

 

Intro. to exhaustive search; pruning, recursion and backtracking; Boggle game example

Handout, Notes

 

Sedgewick Section 1.4

 

 

 

Notes

Wikipedia

 

No recitation

 

Wk 2

(1/15-1/19)

M: Dr. Martin Luther King’s Birthday Observance (no classes)

 

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

 

 

Carrano

Ch. 24 and 25

Lab 1

Homework 1 due on 1/16

Assignment 1 out on 1/19

 

Add/drop period ends on 1/19

Wk 3

(1/22-1/26)

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

Sedgewick Sec. 3.2

Lab 2

Homework 2 due on 1/23

Lab 1 due on 1/26

 

 

Extended add/drop period ends on 1/26

Wk 4

(1/29-2/2)

Self-balancing trees

 

 

explicit stack instead of recursion for tree operations, tree iterators

 

 

Sedgewick Sec. 3.3

 

Carrano

Sections 25-12 to 25-15

Assignment 1 Support

Homework 3 due on 1/30

Lab 2 due on 2/2

Wk 5

(2/5-2/9)

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

 

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

 

Notes

Sedgewick Sec. 5.2

 

 

Notes

Lab 3

Homework 4 due on 2/6

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

Assignment 2 out on 2/9

Wk 6

(2/12-2/16)

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

Notes

Sedgewick Sec. 5.5

 

 

 

 

 

 

 

Midterm Review

Homework 5 due on 2/13

Lab 3 due on 2/16

 

Wk 7

(2/19-2/23)

Burrows-Wheeler compression algorithm; Comparison of compression algorithms; Limits on compression and information entropy

 

Priority Queue ADT and Heap implementation and run-times; Indexable PQ implementation

Notes

 

 

 

 

Notes

Sedgewick Section 2.4

Assignment 2 Support

Midterm exam on Wednesday 2/21

Wk 8

(2/26-3/1)

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

 

Midterm exam

Notes

Sedgewick Section 4.1

 

Review for the midterm

Lab 4

Homework 6 due on 2/27

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

Assignment 3 out on 3/1

Wk 9

(3/4-3/8)

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

 

Articulation points and biconnected components

Notes

Sedgewick Section 4.1

Assignment 3 Support

Homework 7 due on 3/5

Lab 4 due on 3/8

 

Monitored Withdrawal forms due by 3/8

Spring Recess for students (no classes)

Wk 10

(3/18-3/22)

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)

 

Brief discussion of Kruskal's MST algorithm

Notes

Sedgewick Section 4.3

Lab 5

Homework 8 due on 3/19

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

Assignment 4 out on 3/22

Wk 11

(3/25-3/29)

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

 

Bellman-Ford Shortest-paths algorithm; real-time map results

 

Sedgewick Section 4.4

 

 

Assignment 4 Support

Homework 9 due on 3/26

Lab 5 due on 3/29

 

Wk 12

(4/1-4/5)

Dynamic Programming (DP): Idea; "Bottom up" and "memoization"; Fibonacci example; Subset Sum problem (idea, branch and bound solution, DP solution); Knapsack problem (branch and bound solution, DP solution), Edit Distance with computational biology applications (DP solution)

Notes

 

 

 

 

 

 

 

Lab 6

Homework 10 due on 4/2

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

Assignment 5 out on 4/5

 

Wk 13

(4/8-4/12)

DP in Reinforcement learning

 

Local search using Lloyd's algorithm for k-means

 

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

Notes

 

 

 

 

Notes

Sedgewick pp. 886-902

Assignment 5 Support

Homework 11 due on 4/9

Lab 6 due on 4/12

Wk 14

(4/15-4/19)

Min-Cut vs. Max Flow

 

Push-relabel network flow algorithm; Max cardinality bipartite matching via reduction to network flow

Sedgewick pp. 902

 

Notes

 

Final Exam Review

Homework 12 due on 4/16

Assignment 5 due on 4/19 @ 11:59pm

 

 

Finals Week

(4/22-4/26)

Finals Week

Prepare for the final

 

Final Exam on M 12/11 from 8-9:50 am

 

Communication Policy

 

 

Please reach out to the teaching team as early as possible and as frequently as possible. You can reach the course instructor during office hours and on Piazza (you can send public and private messages). Please expect a response within 72 hours. This term we will be using Piazza for class discussion. The system is highly catered to getting you help fast and efficiently from classmates, the TA, and myself. Rather than emailing questions to the teaching staff, I encourage you to post your questions on Piazza. If you have any problems or feedback for the developers, email team@piazza.com.

 

Your Well-being Matters

College/Graduate school can be an exciting and challenging time for students. Taking time to maintain your well-being and seek appropriate support can help you achieve your goals and lead a fulfilling life. It can be helpful to remember that we all benefit from assistance and guidance at times, and there are many resources available to support your well-being while you are at Pitt. You are encouraged to visit Thrive@Pitt to learn more about well-being and the many campus resources available to help you thrive. 

 

If you or anyone you know experiences overwhelming academic stress, persistent difficult feelings and/or challenging life events, you are strongly encouraged to seek support. In addition to reaching out to friends and loved ones, consider connecting with a faculty member you trust for assistance connecting to helpful resources. 

 

The University Counseling Center is also here for you. You can call 412-648-7930 at any time to connect with a clinician. If you or someone you know is feeling suicidal, please call the University Counseling Center at any time at 412-648-7930. You can also contact Resolve Crisis Network at 888-796-8226. If the situation is life threatening, call Pitt Police at 412-624-2121 or dial 911.

 

Health and Safety Statement

I would like to emphasize that my number one concern is your safety and health, both physical and mental.  My goal is for 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 some 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.

 

During this pandemic, it is extremely important that you abide by the public health regulations, the University of Pittsburgh'health standards and guidelines, and Pitt's Health Rules. These rules have been developed to protect the health and safety of all of us. The University's requirements for face coverings will at a minimum be consistent with CDC guidance and masks are required indoors (campus buildings and shuttles) on campuses in which COVID-19 Community Levels are High. This means that when COVID-19 Community Levels are High, you must wear a face covering that properly covers your nose and mouth when you are in the classroom. If you do not comply, you will be asked to leave class. It is your responsibility to have the required face covering when entering a university building or classroom. Masks are optional indoors for campuses in which county levels are Medium or Low. Be aware of your Community Level as it changes each Thursday. Read answers to frequently asked questions regarding face coverings. For the most up-to-date information and guidance, please visit the Power of Pitt site and check your Pitt email for updates before each class.

If you are required to isolate or quarantine, become sick, or are unable to come to class, contact me as soon as possible to discuss arrangements. Arrangements include, but are not limited to, providing a Zoom link to join class remotely.

 

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

 

No Use of Generative AI Permitted

 

Intellectual integrity is vital to an academic community and for my fair evaluation of your work. All work completed and/or submitted in this course must be your own, completed in accordance with the University's Guidelines on Academic Integrity. You may not engage in unauthorized collaboration or make use of ChatGPT or any other generative AI applications at any time.

Religious Observances


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.

Equity, Diversity, and Inclusion

The University of Pittsburgh does not tolerate any form of discrimination, harassment, or retaliation based on disability, race, color, religion, national origin, ancestry, genetic information, marital status, familial status, sex, age, sexual orientation, veteran status or gender identity or other factors as stated in the University's Title IX policy. The University is committed to taking prompt action to end a hostile environment that interferes with the University's mission. For more information about policies, procedures, and practices, visit the Civil Rights & Title IX Compliance web page.

I ask that everyone in the class strive to help ensure that other members of this class can learn in a supportive and respectful environment. If there are instances of the aforementioned issues, please contact the Title IX Coordinator, by calling 412-648-7860, or e-mailing titleixcoordinator@pitt.edu. Reports can also be filed online. You may also choose to report this to a faculty/staff member; they are required to communicate this to the University's Office of Diversity and Inclusion. If you wish to maintain complete confidentiality, you may also contact the University Counseling Center (412-648-7930).

 

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.