CPSC 221: Basic Algorithms and Data Structures
2014 Winter Term 2
Lab/Lecture Notes


Home Learning Goals Schedule Administration Readings Lab/Lecture Notes Assignments Computing

  • Handouts for the course as a whole
  • Lab handouts/materials
  • Section 201 (Hu, MWF) handouts/materials
  • Section 202 (Khosravi, TTh) handouts/materials
  • Old CPSC 221 lecture recordings -- optional and just for your reference, only accessible from ubcsecure wireless or a UBC VPN
  • (Assignments are available from the assignments page.)

    Handouts for Everyone!

    Here are some possibly-helpful notes:

    man rand

    Lab Handouts

    Lab Resources Date
    Lab 1: An Introduction to Programming and Compiling in C++ Jan 12 - Jan 16
    Lab 2: Debugging an Insertion Sort program, and Analyzing C++ pointers and reference parameters
    • lab2.zip contains all the files you need for this lab
    • In the first part of the lab, you need to find the bugs and fix them. Only insertion.cc needs to be changed.
    • After doing the second part ("fill in the blanks") you can verify your answers using a program you can compile with "make pointers".
    • The third part is optional, for those that want a deeper understanding. There are no bonus points.
    Jan 19 - Jan 23
    Lab 3: C++ Class and Linked Lists
    • lab3.zip contains all the files you need for this lab
    • First, you'll complete some function members of a simple C++ Class. (Read the "helpful links" to save yourself some time.)
    • Next you'll code three functions that manipulate Linked Lists.
    • The third part is optional, but recommended.
    Jan 26 - Jan 30
    Lab 4: Binary Search Trees Feb 2 - Feb 6
    Lab 5: Minimum Heaps
    • lab5.zip contains all the files you need for this lab
    • Notes:
    • Since Mon 9 Feb is a holiday, Monday sections will do this after the break (on Feb23).
    • Feb 5, 4:00 pm - new version of lab5_files.zip (small change in main.cc)
    • Feb14: A more durable Makefile resolves a compile-time error seen during labs. See Piazza Post @213 for more details.
    • Feb27: Flaws in the Unit tests have been corrected. If you do a LITTLE work, it will save time in the Lab and might catch errors that could cost you a point. See instructions in lab5B_Minheap. (It really is a SMALL change to Minheap.cc; the rest of the changes are in the files that you were not required to alter.)
    Feb 10 - Feb 23
    Lab 6: Marking Lab 5 and Midterm Review Feb 27 - Mar 5
    Lab 7: QuickSort
    • Click the Quick Sort button on this Visualizer for a demo.
    Mar 6 - Mar 12
    Lab 8: AVL trees
    • lab8.zip contains all the files you need for this lab
    • Click the Options button to do the rotations manually, or go step by step, on this AVL tree Visualizer.
    Mar 13 - Mar 19
    Lab 9: Hashing
    • lab9.zip contains all the files you need for this lab
    • Linear, Quadratic and Double Hashing are demonstrated on this Hashing Visualizer.
    Mar 20 - Mar 26
    Lab 10: Parallel
    • lab10.zip contains all the files you need for this lab
    • Since both labs that used AVL trees used the same codebase, you've never seen the older code base before, so here it is 2014W1 avl.cpp
    Mar 27 - Apr 2
    Lab 11: Marking Lab 10 and Foundations of Computing Concept Inventory note1: Students that have their lab on Mondays can drop by other labs and get their work marked.

    note2: There will be a concept inventory test during this lab. It should take you no more than 30 minutes to complete. Participating in this test is COMPELTELY VOLUNTARY, but you will be given a bonus mark. Doing the Concept inventory is worth 1 lab point (0.33% course grade)
    Apr 7 - Apr 10

    Section 201 (Hu, MWF) Handouts

    I will try to post my lecture slides before they are presented in class, usually by at least the day before. However, sometimes I make changes just before (or during!) lecture, in which case, I will update them afterwards.

    Section 202 (Khosravi, TTh) Handouts

    The pre-notes for each lecture are posted here. I will post the slides that we will be covering as soon as they are ready, and no later than 11:59pm on the day before we cover them.
    Topic Readings from Epp Sections (3rd ed/4th ed) Readings from Koffman Sections Dated to be coverd





    Slides with lecture notes, clicker questions, and examples are posted after each lecture.

    Topic Readings from Epp Sections (3rd ed/4th ed) Readings from Koffman Sections Useful Resources, Examples or Articles Dated Posted
    Introduction Chapters P and 1 fib.cc Jan 6
    Crash course on arrays and pointers Chapters P and 1 leak.cc Jan 8
    ADTs, Stacks, and Queues Lecture Slides 4.5-4.7, 5, 6.1-6.3, 6.5 Jan 13
    Asymptotic Analysis 9.2, 9.3/11.2, 11.3 2.6 Jan 29
    Priority Queues and Heaps 8.5 Parameter passing in C++ (ppt) Feb 10
    Recursion and Iteration
    Optional reading material: Iteration, Induction, and Recursion by Jeffrey Ullman
    5.1, 5.2 7.1, 7.2, 4.2, 4.3, 4.5 /6.1, 6.2 7.1, 7.2, 5.2, 5.3, 5.5 Chapter 7 permute.cc

    endlesslyGreet.cc

    Feb 26
    Sorting
    9.5 /11.5 10.1 - 10.4 and 10.7-10.10 Mar 3
    Binary Search Trees 11.5/10.5 8.1-8.4 Mar 12
    AVL Trees 11.1, 11.2 Mar 17
    Hashing 7.3/9.4 9 Mar 24
    Parallelism and Concurrency, part1

    Parallelism and Concurrency, part2

    Additional Notes on Parallelism and Concurrency
    count_matches.zip Apr 10




     

    cs221@ugrad.cs.ubc.ca
    Last Modified: Fri 27 Feb, 2015