CSCI 241 - Data Structures

Scott Wehrwein

Spring 2023

Course Overview

Who

Where and When

Lecture and Lab

CRN Lecture (Carver 103) Lab Time Lab Location Lab TA
20300 MWF 9:00–9:50am T 10:00–11:50am CF 165 Josh
21235 MWF 9:00–9:50am T 12:00–1:50pm CF 165 Josh
21715 MWF 10:00–10:50am W 8:00–9:50am CF 165 Josh
21716 MWF 10:00–10:50am W 12:00–1:50pm CF 164 Angus

Office Hours

What

Synopsis from the WWU Course Catalog

Design and implementation of hash tables, general trees, search trees, balanced trees and graphs. Comparison of sorting algorithms. Demonstration of the use of data structures in various applications. Evaluation of the best data structure for a particular task. Programming is required in implementation of concepts.

Official Course Outcomes

At the end of this course, students will have:

Why

The goal of this course is to round out your knowledge of the fundamental data structures and algorithms that comprise the basic toolbox of a computer scientist or software developer. Along the way, we’ll encounter and develop the following big ideas that permeate many more advanced subfields of computer science:

By the end of this course, students should be able to:

Textbooks

The following texts may serve as useful references, but are not required:

In both cases, the specific edition of the book is not important significant for purposes of this class. If you’re getting CLRS with the intent to use it later, you may want to go with the latest edition.

Assessment

Grade Breakdown

Grades will be calculated as a weighted average of scores on the following course components, each of which is described in more detail below:

In this class we follow the notational convention that a range of integers denoted a..b describes the range beginning at (and including) a up to but not including b (this is consistent with Python’s range function). For example, 1..4 describes the range including 1, 2, and 3 but not 4. The floor function truncates the decimal part of a floating-point value (that is, rounds down to the nearest smaller integer). Final letter grades will be assigned as follows.

floor(%) Grade
 ≥ 90 A range
80..90 B range
70..80 C range
60..70 D
0..60 F

The calculated raw percentages may be curved nonlinearly at the instructor’s discretion, but any such curve used will not reduce anyone’s grade. “+” or “-” cutoffs will be decided at the instructor’s discretion.

Programming Assignments

Four programming assignments will be given to provide practice implementing the major concepts covered in the course:

Resubmissions

You may resubmit any programming assignment (i.e., A1, A2, A3, A4) within two weeks of when grades are released (or the day of the final exam, whichever is earlier) to earn back up to half of the unit test points you lost. Only unit test points can be earned back. When you resubmit, you must send me an email to request that your submission be regraded for partial credit back.

Extra Credit: Test Suite Gaps

In any of the programming assignments where unit tests are provided, you can earn extra credit if you discover a gap in my test suite. Specifically, if you discover that your implementation passes the provided test cases up to and including the tests for a given method but that method still has a bug, you can earn up to 3 points of extra credit for providing a correct test case that catches the bug.

If you find such a bug and wish to earn extra credit:

  1. With the bug present in your solution code, Create a testing branch in your repository (git checkout -b testing).
  2. Modify the appropriate testing class to include your additional test case. When this test file is run, your test should be the only one up to that point in the test file that fails (unrelated tests from later in the assignment may fail as well).
  3. Commit your test file changes and push your testing branch to github and send me an email me with a detailed description of the bug and the test you’ve written. Please also include a link to your repository.

You can send your test case in anytime starting before the assignment is completed (create your testing branch then simply swich back to master, fix the bug, and continue on) up until 5pm on the last day of classes.

Labs

Weekly labs will provide hands-on experience with auxiliary topics as well as time for work on programming assignments with the TA available to answer questions during the lab period. To get full credit for a lab activity, you must both attend lab and hand in the deliverable by the deadline, which will typically be 10:00pm on the Sunday following the lab period. Attending a lab section other than the one you are registered for requires permission from both me and both lab TAs. If you do not attend lab but do submit the deliverable on time you will receive half credit (i.e., your score will be multiplied by 0.5). This non-attendance penalty is automatically waived for one lab; if you have a legitimate reason for missing additional labs, contact me ahead of time. No late lab submissions will be accepted.

Quizzes

Weekly quizzes will be given most Fridays after the first week, covering material up to but not including that day’s topic. Quizzes usually focus on material from the preceeding Friday, Monday, and Wednesday’s classes. I have a strict policy against makeup quizzes, but your lowest quiz grade will be dropped. If special circumstances cause you to miss taking more than one quiz, please talk to me ahead of time.

Midterm Exam

The midterm exam will be given on paper in class on May 5th and will cover material through Lecture 13 (May 1st). You will be allowed to use one double-sided 8.5x11 sheet of handwritten notes.

Final Exam

The final exams are scheduled as follows:

The final exam will be cumulative, but slightly more emphasis will be placed on material covered since the midterm. You will be allowed to use two double-sided 8.5x11 sheets of handwritten notes. Per the University Academic Policies, a student who fails to take a final examination without making prior arrangements acceptable to the instructor receives a failing grade for the course.

I do not release final exams or final exam grades. This means that at the end of the quarter, your score on Canvas will not reflect your final grade in the course. If you wish to see your final exam, you can review your final exam in-person in my office starting at the beginning of the following quarter by visiting my office hours or emailing me to make an appointment.

Exercise Solution Sets

Before each class, you will watch up to three short videos and work through a set of Exercises that test your understanding of the material from the videos. You will submit your individual solutions to Canvas to the assignment titled “E##I” (I for Individual; ## is the lecture number). Individual solutions will be graded for completion. Your lowest three E##I scores will be dropped when calculating this portion of the grade. The individual solution sets constitute 5% of the total grade weight.

In class, your team will get together and collaboratively write a solution set for the exercises. The group’s solution set will be handed in during class and graded for correctness. Grades for team solutions will be in a Canvas assignment titled E##T (T for Team). Your lowest three E##T scores will be dropped when calculating this portion of the grade. The team solution sets constitute 10% of the total grade weight.

Note that the Exercises to be completed before lecture are distinct from Problems, which you will work on in class after finishing your collective Exercise solution set. Grades will be based only on Exercises, not Problems - the Problems are designed to challenge you, so I do not expect that all groups will be able to finish all of them. Some class time will be spent in groups working on Problems, while some will be spent discussing Exercise and Problem solutions.

Attendance and Professionalism

The groupwork-heavy design of this course is motivated by research that shows that peer instruction is an effective teaching methodology that improves student learning outcomes. If you are absent or disruptive, this is detrimental not only to your own learning, but to your peers’ as well. To get credit for the team-based submission, you must be present and engaged for the entire class period. By writing your name on an Exercise Solution Set in class, you are certifying that you are present for the whole class period and actively participating during group work. If you list your name after arriving late or before leaving early, this can be considered a breach of academic honesty. If you arrive late or leave early, you may participate in group work as usual, but you will leave your name off the Solution Set sheet and you will be considered absent for grading purposes.

Resources for Getting Help and Support

Help with Course Content

If you are stuck, struggling, or need help on any aspect of the course, you have several avenues for seeking help:

Other Resources

Faculty Community Ambassadors

The Computer Science department has Faculty community ambassadors. The role of these ambassadors is to hear concerns, feedback, or questions from students, faculty and staff, especially (but not limited to) those related to equity, inclusion and diversity issues. We hope that the Community Ambassadors can advise and also guide people to college, university or external resources.

Our current Faculty Community Ambassadors are Yasmine Elglaly and myself (Scott Wehrwein). You can find more information on Commnity Ambassadors and contact details for both at the following link: https://cs.wwu.edu/diversity-equity-inclusion.

University Resources

As a reminder, the following University resources are always available:

Logistics

Course Webpage / Syllabus

The Schedule section of this page will be kept up-to-date as the quarter progresses with topics, links to all lecture materials (videos, slides, exercises, problems, and readings), as well as links to assignment and lab handouts. I suggest bookmarking this page (including the #schedule at the end will link you straight to that part of the page); if you forget the URL and need to find your way back here, you can find the link on the Syllabus page in Canvas.

Computer Labs

The CS department maintains a set of Computer Science computer labs separate from the general university labs. These systems are all set up with the software that you need to complete the work for this class.

CS Accounts
To log into the machines in these labs, you will need a separate Computer Science account, which you’ll already have if you’ve previously taken another CS course at Western. If you haven’t taken a CS course at Western before, this will be created for you in the first week of classes. Your username will be the same as your WWU username, but you will need to activate your account and set a new password by visiting http://password.cs.wwu.edu. Note that you’ll need to do this before your first lab, since you’ll be unable to log into the computers to access a web browser until you’ve done this.

Lab Locations and Access
The following rooms in Communications Facility are CS Department labs: 162, 164, 165, 167, 405, 418, 420. These labs are open to all CS students (that’s you!) any time except when scheduled for a class or other activity. The complete of CS labs and their schedules can be found on the CS Support documentation. CF 405 is never booked, so it’s always available. Labs are open 24/7, although the building locks at 11pm so you won’t be able to enter later than that.

Using Labs Remotely

Please see the Remote Access Instructions for details on how to work remotely in the CS lab environment.

Canvas

We will use Canvas for announcements, assignment invitation links, grades, and some other logistics. Lab and assignment writeups, lecture materials, readings, etc. will all be linked from the course webpage. Numerical grades will be entered into Canvas to track your scores for assignments in the course, but feedback on your assignments will be provided via Gradescope (quizzes and exams) or Git (assignments and labs), as described in the sections below.

Gradescope

Quizzes and exams will be graded and returned to you via an online tool called Gradescope. You will receive an email around the time of the first quiz with instructions on how to set a password for the account that has been created for you. Logging in for the first time is the same process as resetting your password - begin by clicking the “forgot password” link. Thereafter, you can access graded quizzes and exams by logging into your account on http://www.gradescope.com.

Git and GitHub

Labs and assignments will be completed using Git repositories hosted by GitHub and orchestrated by GitHub classroom. For each assignment and lab, you will find an invitation link in the assignment page on Canvas. This link will create your private repository where you will complete the assignment in a local copy of the repo, and submit your code by pushing your final changes to GitHub. To complete your submission, you will also fill out a Canvas survey letting me know how many hours you spent on the assignment.

To grade your assignments (and in some cases, labs) Github Classroom automatically creates a feedback branch in your repository and a pull request to merge all the commits you’ve made to master into the feedback branch. This allows us to use Github’s code review tools to give you feedback directly in your repository. To access your feedback, go to your repository on github.com click “Pull Requests” from among the tabs across the top, then click “Feedback” in the list on that page. You should see a log of comments and feedback, including line-by-line comments if we’ve left any.

For the assignments with unit tests, we’ve also set up Github Classroom to automatically run your code on those tests every time you push your changes to github. This is a form of continuous integration testing, which is a fancy term for “run ALL the tests every time you change anything”. You’ll probably get emails telling you the outcome of the checks (which will only be successful if you pass all tests); I think there’s a way to unsubscribe from them, or you can use an email filter to keep your inbox clutter to a minimum.

Discord

The course Discord server is a good way to interact with your classmates and ask questions. You can find the server invite link on the Syllabus page on Canvas. I try to check the q-and-a channel regularly and answer questions when possible, but I also hope that classmates will be able to step in and answer questions before I get to them.

Discord is not the place to get help that requires viewing of code, nor is it the place for “official” course communication. A couple points of Discord etiquette that I will require for this class:

Communication Guidelines

Announcements

I will make all course-related announcements either in class or on Canvas. In-class announcements will be posted on the Schedule table on the course webpage. It is your responsibility to make sure that you see Canvas announcements promptly and check the in-class announcements if you miss class. Canvas should be configured to send you an email notification by default, but if you are unsure, please come see me in office hours.

Email

Email is the best way to get in touch with me. I do my best to check email regularly and respond when I can, but I am not able to be instantly responsive all the time. If you have something time-sensitive, email is the medium that I am most likely to see first. You can use Canvas messages as an alternative; these simply go to my email.

Grace

The policies for this course have “grace” built in for most categories of assignments: you have slip days for assignments, your lowest quiz gets dropped, you can miss one lab without an attendance penalty, and you can miss up to three E##I and three E##T submissions without penalty.

If any of the above forms of “grace” apply to your situation, you do not need to contact me: the grace policies are applied automatically. If you have used up all of a certain kind of grace and extenuating circumstances will cause you to go beyond the allowed grace, please contact me by email or in person to explain your situation.

Canvas Submission Comments

I do not read Canvas submission comments, so please do not use them. If you have a message for me and/or the TAs, please use email instead.

See Me After Class

Many quick questions can be resolved in a timely fashion by talking to me after class instead of using email or waiting for office hours. I will be available in the 10 minutes following lecture, so please feel free to use this time.

Feedback

I take student feedback seriously. I appreciate any feedback you’re willing to give, and I will do my best to act on constructive feedback when possible. I will solicit feedback through surveys periodically throughout the course, but you are welcome and encouraged to provide feedback anytime in my office hours, by email, or if you desire anonymity you can fill out this Google Form.

Schedule

This table contains a schedule of topics and links to all course materials. Rows in the future should be considered tentative and subject to change.

Date # Videos Slides E/P Topic Assigned/Due References
3/29 (0) 0 intro Problems Intro, logistics
3/31 1 A: 5:18
B: 13:14
C: 9:21
A
B
C
Exercises
Problems
Tools for algorithms, Searching
announcements
How to succeed
RS 13.2-13.3, CLRS 2.1-2.2
4/3 (1) 2 A: 9:42
B: 10:18
C: 19:13
A
B
C
Exercises
Problems
Runtime analysis
announcements
Lab 1:
Git, Gradle
RS 13.2-13.3, CLRS 2.2
4/5 3 A: 9:45
B: 10:26
C: 15:02
A
B
C
Exercises
Problems
Insertion and selection sort
announcements
A1 out RS 13.2-13.3, CLRS 2.1-2.2
4/7 4 A: 4:19
B: 8:20
C: 5:14
A
B
C
Exercises
Problems
Recursion
announcements
Quiz 1 Tutorial: Method execution
RS 12.1-12.3
4/10 (2) 5 A: 6:59
B: 7:15
C: 8:24
A
B
C
Exercises
Problems
MergeSort
announcements
Lab 2:
Testing
RS 13.4, CLRS 2.3
4/12 6 A: 10:42
B: 5:27
C: 6:14
A
B
C
Exercises
Problems
Quicksort, Stability, Space Complexity
announcements
CLRS 7.1
4/14 7 A: 13:26 A Exercises
Problems
Comparison Sorts
Radix Sort
announcements
academic honesty activity
Quiz 2 CLRS 8.2-8.4
4/17 (3) 8 A: 7:50
B: 4:59
C: 6:10
A
B
C
Exercises
Problems
Trees, Traversals,
Recursion on trees
announcements
Lab 3:
Recursion
RS 17.1-17.3
4/19 9 A: 9:52
B: 8:21
C: 6:44
A
B
C
Exercises
Problems
Binary Search Trees
announcements
CLRS 12.1-12.3
RS 17.4
4/21 10 A: 9:54
B: 5:01
C: 9:26
A
B
C
Exercises
Problems
Generics
Tree Rotations
announcements
A1 due
Quiz 3
CLRS 13.2
4/24 (4) 11 A: 6:20
B: 9:19
A
B
Exercises
Problems
AVL Trees
announcements
Lab 4: AList
A2 out
Eric Alexander’s AVL Tree Notes
4/26 Buffer day - Partition Code Review!
4/28 12 A: 4:31
B: 8:42
C: 3:39
A
B
C
Exercises
Problems
Heaps
announcements
Quiz 4 RS 18.2; CLRS 6.1-6.3
5/1 (5) 13 (None) (none) (No Exercises)
Problems
Heapsort Lab:
Midterm Review
RS 18.2; CLRS 6.1-6.3
5/3 Buffer day
5/5 Midterm Exam
5/8 (6) 14 A: 3:57
B: 6:23
C: 4:05
A
B
C
Exercises
Problems
Hashing 1
announcements
Lab 5: Hash functions
A2 Due
A3 out
RS 18.1; CLRS 11.1-3
5/10 15 A: 5:23
B: 3:45
C: 4:16
A
B
C
Exercises
Problems
Hashing 2
announcements
CLRS 11.3-4
5/12 16 A: 6:44
B: 4:35
C: 2:13
A
B
C
Exercises
Problems
Graphs: definition, representation
announcements
Quiz 5 CLRS 22.1-2
5/15 (7) 17 A: 6:12
B: 3:05
C: 2:37
L17P
A
B
C
Exercises
Problems
Graph traversals
announcements
Lab 6:
Connected Components
CLRS 22.3
5/17 18 A: 12:37
B: 3:45
C: 3:17
A
B
C
Exercises
Problems
Dijkstra’s algorithm
announcements
CLRS 24.3
5/19 19 A: 6:40
B: 10:42
C: 12:21
A
B
C
Exercises
Problems
Tries
announcements
Quiz 6
5/22 (8) 20 A: 9:14
B: 7:34
A
B
Exercises
Start on Lab 7
Huffman Coding Trees
announcements
Lab 7: Huffman Coding
A3 due
A4 out
CLRS 16.3
5/24 A: 9:43 A (No Exercises)
Problem
Dijkstra: Proof Quiz 7 CLRS 24.5
5/26 Problems Coding Interview Problems
5/29 (9) No class - Memorial Day No Lab: Memorial Day
A4 due
5/31 Ask me anything or no class
6/2 Ask me anything or no class
6/7 (Wednesday) Final Exam - 9am section
10:30 - 12:30pm
6/8 (Thursday) Final Exam - 10am section
10:30 - 12:30pm

Course Policies

Professionalism

I am committed to maintaining an inclusive, supportive, and professional environment in all academic settings including lectures, labs, and course-related online spaces. Students are expected to live up to the ACM Code of Ethics and Professional Conduct. This is the ethical code adopted by nearly every software professional. Failing to follow the ACM Code of Ethics and Professional Conduct can negatively affect course grades up to and including a failing grade for the course. Conduct is also considered when determining admission to the major.

Attendance

As described above in the Assessment section, you are expected to attend both class and lab. Up to three absences from class will not affect your grade; additional absences will cause deductions on the in-class portion of your grade. For labs, the 50% absence penalty will be waived for one lab. If you have reasons that you need to miss class or lab beyond these limits, please talk to me about case-by-case exceptions.

Late Work

You have three “slip days” that you may use at your discretion to submit programming assignments late. Slip days apply only to programming assignments and can not be applied to any other deadline, including labs. You may use slip days one at a time or together - for example, you might submit each of three assignments one day late, or submit one assignment three days late. A slip day moves the deadline by exactly 24 hours from the original deadline; if you go beyond this, you will need to use a second slip day, if available.

After your slip days are exhausted, a penalty of 10% * floor(hours_late/24 + 1) - that is, 10% per day late unless you have made prior arrangements with me.

How to Submit Late

Submission of assignments is done by (1) pushing your final changes to Github and (2) filling out a Survey quiz on Canvas. To submit late, you don’t need to let me know: simply don’t submit the Canvas survey until you are done. Slip days will be applied automatically based on when you submitted the survey; your grader will note the number of slip days applied in your feedback.

Programming Guidelines

Your programs will be graded on correctness, clarity, and efficiency (in that order).

Correctness:

A correct program is one that always produces the correct output for a given input. Also, a correct program does not produce unintended side-effects. The most effective way to ensure that your program is correct is to test, test, test. Test each component as you introduce it; once you are confident that a component works you can use it in other routines. Try to break your program in testing, and if you succeed, locate the bug and fix it. The better you test your program, the more likely it is to be correct - the more likely it is to be correct, the more likely you’ll earn a good score. Most of your grade will depend on the correctness of your code.

Clarity:

The easier it is to read and maintain your code, the easier it is to locate and remove bugs. Your program should be well organized, appropriately commented, and easy to maintain. To have a well-organized program, design your program thoughtfully and modularly. Think before you code: hacking away blindly leads to ugly, difficult-to-read code. If you do hack away, producing a functional but ugly wall of code, try to clean it up a bit. Make sure that your cleaning does not introduce new bugs.

As for comments, please follow these simple guidelines proposed by Emeritus Professor Osborne:

Efficiency:

Your programs should be asymptotically efficient, e.g. checking graph reflexivity should be O(n), insertion into a balanced tree should be O(log n), etc. Do not optimize your code beyond the asymptotic level, as such tweaks are often at the expense of clarity, correctness, or both.

Academic Honesty

Collaboration Policy - Individual Assignments

Individual programming assignments are to be completed independently. Students are welcome to discuss assignments with each other on a conceptual level, but each student should be writing their code independently and without direct help from fellow students. Sharing your code with others or looking at someone else’s code is an explicit violation of this collaboration policy. To make sure you are collaborating appropriately, follow these two rules:

Automated tools will be used to check your code for plagiarism at the push of a button. They are not fooled by tricks such as changing variable naming and whitespace: in fact, hiding plagiarism is harder than doing the assignment.

Changes to the Syllabus

This syllabus is subject to change. Changes, if any, will be announced in class or online. Students will be held responsible for all changes.

University Policies

All University-wide policies apply to this course, including those outlined at http://syllabi.wwu.edu. These policies cover issues including: