Labs

General information

For the most part, COSC201 labs are going to be done in a workshop style. We will typically provide some skeleton code and some questions, and it’s up to you to think about the problems and add to the code so that you can answer the questions.

Per week you have two lab sessions (an A and a B stream) but only one set of assigned lab work. Some of the lab descriptions might look simple at first glance but you will typically need both lab sessions to complete the tasks satisfactorily!

Labs will normally be assessed in class by the tutors or Teaching Fellow, and you have until the end of the following week to get your work marked (but it’s better to complete it during the week issued). Not all labs have credit associated with them, but for those that do, it’s a simple complete/incomplete distinction, based on whether you have satisfactorily engaged with the material. Completing eight assessed labs over the course of the semester will get you full credit for the lab component of the internal assessment. Completing more than eight labs will get you a sense of satisfaction and a deeper knowledge of data structures and algorithms but, I am afraid, still only full credit for the lab component of the internal assessment.

Remember that for most labs there will be some skeleton code available in the cosc201code2026 repository - and other code there could be helpful too! Please see the repo’s README for details.

To request help during the labs, please use DemCall.

Lab details

Full details of the upcoming labs will be released as the course progresses.

Note that there will be no A stream for COSC201 during the first week, so your first lab class will be on Thursday or Friday. If you are also enrolled in COSC202, you don’t need to come to a COSC201 lab until Week 2.

  • Lab 0: Introduction (not assessed). You need to get familiar with the lab setup. If you’re taking COSC202 as well, then your COSC202 labs for week 1 are designed to do that. If not, then please attend your regular COSC201 lab B session on Thursday or Friday and helpful staff will be there for you! There are no A sessions (Mon/Tue) this week. The COSC202 Tiddlywiki will give you instructions on the basic use of Java, the NetBeans IDE, and the Gradle build tool. For deeper reading on software development, the COSC202 Lab Book has useful content.
  • Lab 1: Timing things (assessed, Week 2, due by March 13). In this lab you’ll answer some basic questions about wall-clock timing of programs, and think about the relationship with the more theoretical analysis of algorithmic timing. For those not doing COSC 202: you should also carry out the Git Started and Unix Shell activities from the COSC 202 course handbook.
  • Lab 2: Recursion and union-find (assessed, Week 3, due by March 20). In this lab you’ll look at some timing in recursive functions (and variations) and then, as a preparation towards Assignment 1, work a bit with the union-find data structures and look at writing a program to read scripts and carry out operations on them. There’s a video in the Demonstrations section in Echo360 called “Writing a script reader” that might be useful (this was recorded in an earlier year so the references to lectures might be out of step).
  • Lab 3: Shuffling along (assessed, Week 4, due by March 27). In merge sort, a fundamental operation is merging two halves of an array into a single one based on the order of the relevant elements. What if we do that merge randomly instead? Then we’re shuffling. In this lab you’ll implement a simple version of that shuffle and investigate how well it works.
  • Lab 4: Random algorithms (assessed, Week 5, due by April 2). In this lab you’ll delve deeper into how (pseudo-)random number generators (RNGs) work, perform some tests for RNG quality, and investigate the use of RNGs in simulations.
  • Week 6 (beginning March 30): No assessed lab this week as we expect you’ll be finishing up Assignment 1. The demonstrators can provide some help (with limits of course). If your lab falls on the Good Friday holiday, come to one of the Thursday streams instead (9am in OWG01, midday in OBS320).
  • Mid-Semester Break (April 3–12)
  • Lab 5: Playing in the trees (assessed, Weeks 7 and 8, due May 1). In a change from our usual practices, we are going to ask you to implement a standard data type for which a library class exists, namely the binary search tree. There is a lot of material in this lab which is why it is spread over two weeks and counts double.
  • Lab 6: Stringing you along (assessed, Week 9, due May 8). A fairly short and straightforward lab that allows you some practice with HashSet.
  • Lab 7: Combining Collections (assessed, Week 10, due May 15). A look at combining data structures (map + set = multimap) in finding anagrams.
  • Lab 8: Graphing the dictionary (assessed, Week 11, due May 22). A lab to practice the use of classes for manipulating graphs.
  • Week 12 (beginning May 18): No assessed lab this week as we expect you’ll be finishing up Assignment 2. The demonstrators can provide some help (with limits of course).
  • Lab 9: Dynamic Programming (assessed, Week 13, due May 29) A bit of stuff on dynamic programming with edit distance. Note the narrower deadline due to the early exam.
  • Lab X (end of semester): Propose a lab (bonus lab, due May 29)