CS 124: Data Structures and Algorithms

Jelani Nelson
Course Website:


This course covers the modern theory of algorithms, focusing on the themes of efficient algorithms and intractable problems. The course goal is to provide a solid background in algorithms for computer science students, in preparation either for a job in industry or for more advanced courses at the graduate level. I strongly encourage mathematicians, biologists, physicists, and people from other concentrations to take the course as well.

Besides introducing the basic language and tools for algorithm analysis, we will also cover several specific problems and general design paradigms. Toward the end of the quarter, we will also examine heuristic techniques often used in practice, even though in many cases formal theoretical results are not known.

We will focus on the theoretical and mathematical aspects in class and on the homework assignments. But because one gains a deeper understanding of algorithms from actually implementing them, the course will include a substantial programming component. In particular, most problem sets include at least one problem that requires implementing an algorithmic solution to be tested against our test data. More details will be available when the first programming assignment is given.

As you can see from the preliminary list of topics (included below), we will be covering a great deal. I expect the course to be challenging, both in terms of the workload and the difficulty of the material. You should be prepared to do a lot of work outside of class. The payoff will be that you will learn a lot of both useful and interesting things.


Students should be able to program in one of C, C++, Java, OCaml, or Python. Some mathematical maturity also will be expected; students should have some idea of what constitutes a mathematical proof and how to write one. Some knowledge of basic probability will also be helpful.


Your performance will be measured in three ways. (The percentage contributions to your grade given below are approximate and subject to change.)

All assignments will be due at 11:59pm on the due date. If you wish to use a late day for any reason, see the next section below. If you feel your case warrants more than a 24-hour extension (e.g. medical emergencies or similar exceptional circumstances), then contact the instructors. Please remember it is better to turn in an incomplete assignment rather than no assignment. All assignments should be turned in electronically, as pdf or text files. You should have a scanner available, or be familiar with LaTeX, or otherwise be ready to deal with turning in pdfs of mathemetical work. (LaTeX is highly, highly recommended)

Late Days

You will be given three late days to use throughout the semester. You can use at most one late day per problem set. Late day requests should be made online via the programming server, and they will automatically extend the due date for both your PDF submission on Canvas and your code submission by exactly 24 hours for the entire current problem set. You do not need to, and should not, contact teaching staff regarding late day requests as they are handled automatically online.

Collaboration Policy

I would like to emphasize the rules on working with others on homework assignments. For all problems on the problem sets, including ones requiring programming, limited collaboration in planning and thinking through solutions to homework problems is allowed, but no collaboration is allowed in writing up or coding solutions. You are allowed to work with other students currently taking CS 124 / CSCI E-124 in discussing, brainstorming, and verbally walking through solutions to homework problems. There is no size limit regarding the number of such students you can discuss problems with. But when you are through talking, you must write up your solutions independently and may not check them against each other. There may be no passing of homework papers between collaborators; nor is it permissible for one person simply to tell another the answer.

If you collaborate with other students in the course in the planning and design of solutions to homework problems, then you should give their names on the last page of your homework papers. Also, if you discussed a programming problem with any other students, give their names as well.

Under no circumstances may you use solution sets to problems that may have been distributed by the course in past years, or the homework papers of students who have taken the course past years. Nor should you look up solution sets from other similar courses or attempt to find solutions online.

Also, for programming problems, you may not use code obtained from an online or other 3rd party source. All code you submit must be code that you yourself write. Furthermore, do not intentionally submit malicious code to the server (e.g. code intended to cause the server to crash, or to steal others' submissions, etc.). You also may not mine data about our private test cases for the specific purpose of discovering their properties beyond what is given in the problem statement, nor may you knowingly submit incorrect or inefficient programs fine-tuned to pass our specific test cases. Engaging in activities in this paragraph will result in being reported to the Ad Board and/or your resident dean. The purpose of programming assignments is, aside from helping you learn, testing your ability to come up with and implement correct and efficient algorithms for various problems. Engaging in activities to raise your score while circumventing the spirit of this purpose may be viewed as cheating and result in disciplinary action.

Violation of these rules may be grounds for giving no credit for a homework paper and also for serious disciplinary action. Severe punishments will apply, so please do not violate these rules. If you have any questions about these rules, please ask an instructor.

Required Text

While officially there is no required text, I very strongly recommend you purchase one of the following books:

In place of a book, class notes will be regularly made available. Generally these notes will not be available until a few days after the corresponding lecture.

Class Information/Notes

Class notes, homework assignments, and other information will be made available on the Web when possible. For access go to the class web site. Generally this information will be available in PDF. In many cases, the class web-site may be the only location where information is posted or available, so look in from time to time!

Incomplete List of Topics