Spring Quarter, 2019

Intermediate Data Structures and Algorithms


  • (Jun 6) Problems discussed in class posted
  • (Jun 3) Updated slides on weighted graphs (all-pairs example)
  • (May 25) Midterm 2 posted
  • (May 16) Homework 6 and 7 posted
  • (May 16) Problems discussed in class posted
  • (May 13) Practice exam for midterm 2
  • (May 9) Slides on graphs posted
  • (May 9) Homework 5 posted
  • (May 2) Homework 4 posted
  • (May 1) Dynamic programming slides posted
  • (May 1) Midterm 1 posted
  • (Apr 25) Problems discussed in class posted
  • (Apr 18) Homework 3 posted
  • (Apr 18) Greedy slides posted
  • (Apr 17) Closest pair animation slides posted
  • (Apr 11) Homework 2 posted
  • (Apr 9) Slides on divide-and-conquer posted
  • (Apr 4) Homework 1 posted
  • (Apr 1) Slides on Algorithm Analysis posted
  • (Apr 1) Our TAs are Anuja Patil, Lixiao Li and Tanmay Shah: welcome!
  • Happy Spring Break

  • Overview

    CS 141 introduces the "core" of Computer Science: data structures like graphs, and problem solving techniques. This material is essential in almost all of our upper-division courses.

    Catalog description: CS 141 Intermediate Data Structures and Algorithms 4 Lecture, 3 hours; discussion, 1 hour. Prerequisite(s): CS 014 with a grade of "C-" or better; CS 111/MATH 111; MATH 009C or MATH 09HC; proficiency in C++. Explores basic algorithm analysis using asymptotic notations, summation and recurrence relations, and algorithms and data structures for discrete structures including trees, strings, and graphs. Also covers general algorithm design techniques including "divide-and-conquer," the greedy method, and dynamic programming. Integrate knowledge of data structures, algorithms, and programming.

    Basic information

  • Read the syllabus.

  • Instructor:
  • Stefano Lonardi (stelo@cs.ucr.edu)
  • Office hours: Tuesdays 11am-12noon.
  • Office: CHUNG HALL, room 325.

  • Teaching Assistants:
  • Tanmay Shah (tshah015@ucr.edu)
  • Tanmay's office hours: Tuesdays 10am-11am

  • Lixiao Li (lli132@ucr.edu)
  • Lixiao' office hours: Wednesday 10-11 am

  • Anuja Patil (apati027@ucr.edu)
  • Anuja's office hours: Monday 3-4pm

  • TA Office hours are held in CHUNG HALL, room 110.

  • Lectures:
  • TR 2:10am-3:30pm, Watkins, room 1000.

  • Text Book:
  • Algorithms, by Sanjoy Dasgupta, Christos Papadimitriou, Umesh Vazirani. McGrawHill 2007.

  • References:
  • Introduction to Algorithms (3rd Edition) by Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Cliff Stein, MIT Press.
  • Algorithm Design (Foundations, Analysis, and Internet Examples) by Michael T. Goodrich and Roberto Tamassia, Wiley.

  • Approximate Time Requirements:
  • This is a four-unit CS course. As such, you should expect to spend the following approximate amount of time: 3 hours/week in lecture
    1 hour/week discussion
    6 to 10 hours/week doing individual study (readings, homework, programming assignments, preparation for lectures, etc).
  • Please don't underestimate the time you will need to spend on this course. These are real time amounts spent by average successful past students. Computer Science and Engineering are challenging disciplines requiring extensive time to master.

  • Discussion Board

    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. Find our class page at: https://piazza.com/ucr/spring2019/cs141/home


    Read the book and the slides before lecture! Reading ahead is one of the most effective ways of doing better in class -- you'll be amazed how much more comprehensible and useful the lectures will be. The schedule is subject to change as the quarter progresses.

    Lecture Notes and other Material:

  • Course Overview [PDF]
  • Algorithm Analysis [PDF]
  • Divide & Conquer [PDF]
  • Closest Pair animation [PPT]
  • Greedy (part I) [PDF]
  • Greedy (part II) [PDF]
  • Dynamic Programming [PDF]
  • Weighted Graphs [PDF]

  • Content covered in lectures:
    Week 1
  • Apr  2: Overview of the course, Analysis (slides 1-33)
  • Apr  4: Analysis (34-65) [hw1 posted]
  • Week 2
  • Apr  9: Analysis (66-end)
  • Apr 11: Divide and Conquer (1-32) [hw1 due][hw2 posted]
  • Week 3
  • Apr 16: Divide and Conquer (33-57)
  • Apr 18: Divide and Conquer (58-end), Greedy (1-24) [hw2 due][hw3 posted]
  • Week 4
  • Apr 23: Greedy (25-45)
  • Apr 25: Greedy (46-49), Midterm 1 prep [hw3 due]
  • Week 5
  • Apr 30:Midterm 1
  • May 2: Greedy (50-end), Dynamic Programming (1-28) [hw4 posted]
  • Week 6
  • May 7: Dynamic Programming (29-42)
  • May 9: Midterm 1 review, Dynamic Programming (43-end) [hw4 due][hw5 posted]
  • Week 7
  • May 14: Weighted graphs (1-44)
  • May 16: Weighted graphs (45-50), Midterm 2 prep [hw5 due]
  • Week 8
  • May 21: Midterm 2
  • May 23: Weighted graphs (51-77) [hw6 posted]
  • Week 9
  • May 28: Weighted graphs (78-108)
  • May 30: Midterm 2 review, Weighted graphs (109-119) [hw6 due][hw7 posted]
  • Week 10
  • Jun 4: Weighted graphs (120-end)
  • Jun 6: Final prep [hw7 due]
  • Final's week
  • Jun 13: Final 8am-11am
  • Do not put off reading the assignments or you will risk falling behind. Reading ahead is one of the most effective ways of doing better in class -- you'll be amazed how much more comprehensible and useful the lectures will be.

    Python Code

    Homework and Solutions

    Homework papers should be prepared in LaTeX or some other word-processing system that can handle equations (figures can be hand-drawn), then converted/scanned to pdf format and turned in via Gradescope. Each student's work should be fully authored by his or her self, in his or her own words - that is, each student should turn in only text authored by his or her self. Each student is responsible for understanding all text that they submit. Finally, in each turned-in work, each student should appropriately cite any help or ideas that came from any other source. Violation of this policy is plagiarism and will be referred to the UCR student conduct office.

    Exams and related material

    General course features and policies

    Some useful pointers