Skip to main content

Syllabus

Introduction

CPSC 221 teaches you to design, implement, and analyze the classic data structures and algorithms of computer science — and to reason rigorously about when and why to use them. You’ll come away able to:

  1. Define and articulate the functionality of classic data structures such as stacks, queues, dictionaries, and priority queues by their Abstract Data Type (ADT).
  2. Design algorithms and structures to implement novel ADTs based on properties of the data and intended use.
  3. Implement classic and novel data structures in modern C++, including arrays, linked lists, AVL trees, and hash tables.
  4. Analyze the efficiency (time and space) of algorithms and data structures using asymptotic notation.
  5. Justify algorithmic choices using iterative and recursive proofs of correctness.
  6. Evaluate asymptotic time and space tradeoffs between implementation options.
  7. Identify the structures and algorithms necessary for solving complex problems.
  8. Synthesize and apply algorithmic and analytical design choices to form complete software solutions to classic problems.

Teaching team

  • Instructor (Section 101): Cinda Heeren — cheeren@cs.ubc.ca
  • Instructor (Section 102): Nathan Harms — nharms@cs.ubc.ca
  • Course Coordinator: Anca Barbu — cpsc221-admin@cs.ubc.ca
    Use this address for administrative matters: illness, academic concessions, accommodations, and other logistics.
  • Teaching Assistants: TBA (TA assignments may change during the first three weeks of classes)

Schedule

The general course calendar consists of class meetings, labs, examlets, and due dates for homework and programming assignments. You have registered for specific class and lab meeting times. Examlets will be self-scheduled in ORCA. Homework and programming assignments will be due on some Monday evenings. See the full Schedule for the week-by-week breakdown.

Course Content

A rough list of topics covered, by week:

Week Topic
1 Analysis and running time of linear algorithms
2 Algorithm correctness and linear sorting
3 Linked lists, stacks, and queues
4 Analysis and correctness of recursive algorithms
5 Recursive sorting and intro to trees
6 Tree traversals
7 Binary search trees
8 B-trees
9 Hashing
10–11 Priority queues, heaps, heapsort
12 Graph definitions, implementation, and traversal; disjoint sets
13–14 Minimum spanning trees, shortest path

Deliverables and Grading Scheme

Assessment Weight per assessment Total weight
3 Programming Assignments 2% 6%
3 Homeworks 2% 6%
8 of 10 Labs 1% 8%
9 Examlets 6% 54%
Final Exam 26% 26%

You must pass an appropriately weighted average of the examlets and final exam in order to pass the course.

Programming assignments and homework are project-like: you (and an optional partner) manage your own progress within a 1–2 week work window, and assignments may overlap. Labs are weekly coding exercises auto-graded on PrairieLearn; your 8 highest lab scores (of 10) count toward your grade. Examlets are (nearly) weekly, self-scheduled, and focus on the previous week’s content — practice material includes old exams and PrairieLearn practice problems.

Collaboration policy

Some assignments allow groups of up to 2; others require independent work. For homework and most programming assignments, you may work with at most one partner — but each student must submit their own copy, even if it’s identical to their partner’s.

The point of every assignment is to learn new things and develop skills. Copying a partner’s work, or splitting an assignment in half so each of you only does part of it, means you gain nothing from it — and since assignments carry much less weight than the examlets and final, that lack of practice will show up on the exams that actually determine your grade.

A better approach: do as much on your own as you can, and talk things over with others when you get stuck. Struggling through your own mistakes until you solve a problem teaches the material far better than being told the answer.

Generative AI policy

You are free to use generative AI tools (ChatGPT, Copilot, Claude, etc.) on Programming Assignments, Homework, and Labs, without restriction — but please briefly cite their use in a code comment where you used them (e.g. // used Claude to help debug this function). If you’re working with a coding agent, you can just ask it to add that disclosure comment for you.

We take this approach because we do not want to spend valuable teaching and learning time trying to detect AI use on take-home work. We believe that you are curious and energetic, and this material is fun to master, so we leave it to you to decide how best to learn it.

That said: the entire point of the PAs, HWs, and Labs is to build understanding you can draw upon independently and fluently. Your understanding, fluency, and expertise will be assessed under invigilated conditions (at ORCA) on the examlets and final exam, which together are worth 80% of your grade. AI will not be available on any CPSC221 assessment in ORCA.

See also UBC’s 10 things UBC students should know about generative AI.

Textbooks

There is no required textbook. Lecture and practice material should be sufficient, but if you’d like a reference:

  • Discrete Mathematics with Applications (Epp)
  • Data Abstraction & Problem Solving with C++: Walls and Mirrors (Carrano)

Earlier editions, or textbooks from different authors, work fine too — we’ll be clear about the topics we’re covering so you can find them in any resource. A good C++ reference is a necessity; cppreference.com and learncpp.com are both solid.

Note on Course Environment

Some topics discussed in this course may touch on issues that students find personal, sensitive, or challenging. As we explore different perspectives and critically examine ideas, we all share responsibility for maintaining a respectful, inclusive, and supportive learning environment.

Disrespectful, discriminatory, or harmful comments or behaviors related to race, ethnicity, religion, gender identity, sexual orientation, disability, or other personal characteristics will not be tolerated. Our goal is not to win debates or demonstrate superiority, but to learn from one another, engage thoughtfully with complex issues, and develop our understanding through constructive dialogue and collaboration.

Accessibility

If you have a disability or ongoing medical condition that may require accommodations, please contact the UBC Centre for Accessibility accessibility@ubc.ca to determine your eligibility and receive an accommodation letter.

If you have a specific concern about accessing course materials or if you would like to suggest improvements to the accessibility of this course, please do not hesitate to speak with me.

Academic misconduct

All instances of academic misconduct will be handled in a manner consistent with UBC policies. This includes reporting to the CS Department’s Associate Head of Undergraduate Affairs, and Faculty of Science Associate Dean of Students. No credit will be given for any assignment which was completed with inappropriate collaboration.

Land Acknowledgement

UBC’s Point Grey Campus is located on the traditional, ancestral, and unceded territory of the xʷməθkʷəy̓əm (Musqueam) people. The land it is situated on has always been a place of learning for the Musqueam people, who for millennia have passed on their culture, history, and traditions from one generation to the next on this site.