Below are lecture materials, listed by date.
-
Week 1: Mon 5 Jan
- Slides: OO Design
- Shell: recap about objects
-
Week 1: Wed 7 Jan
- Announcements
- Shell: two kinds of comparison
- Code: point.py
-
Week 2: Mon 12 Jan
- Announcements
- Shell: help, self, special methods
- Updated version of point.py
- Client code that uses class Point:client.py
-
Week 2: Wed 14 Jan
- Announcements
- Updated version of point.py
- Client code that uses class Point:client.py
- Shell: Getting __repr__ to work, and using property to control access to an instance variable
- Slides: Abstract Data Types
-
Week 3: Mon 19 Jan
- Announcements
- Yellow handout, with client code showing the behaviour we wanted from the code we were about to write, plus the interface for the parent class, Employee.
- White handout, with two functions to fill it. The version in the parent class and child class are side by side for comparison.
- Code we developed/reviewed in class:
- company.py
- employee.py
- hourly_employee.py
- salaried_employee.py (we haven't yet looked at this one)
- Complete version of the code:
- company.py
- employee.py
- hourly_employee.py
- salaried_employee.py (we haven't yet looked at this one)
- We have not yet looked at this code, but reading it might help you with assignment 1:
-
Week 3: Wed 21 Jan
- Announcements
- Slides: Inheritance
- Two versions of code we traced in detail on the board:
- lookup.py, which challenges our understanding of how Python looks up methods.
- lookup-2.py, which takes control of which method is called in one key spot.
- Shell: list comprehensions
-
Week 4: Mon 26 Jan
- Announcements
- Code we traced in detail: sum_list.py
- Shell: isinstance and sum
- Worksheet: Recursion exercises
-
Week 4: Wed 28 Jan
- Mystery code to trace: mystery.py
- Slides: Recursion
- Mergesort algorithm
- And here is the code: mergesort.py
-
Week 5: Mon 2 Feb
- Function we designed test cases for (without even seeing the function body): insert.py
- Implementation of some of the test cases in unittest: testInsert.py
- Implementation of the bracket balancer that we sketched: balance.py
-
Week 5: Wed 4 Feb
- Midterm, in EX100
-
Week 6: Mon 9 Feb
- Slides: Trees
- Shell: An aside on the topic of Ternary if
- Code we used/wrote: tree.py (a general tree class)
- A class that tree.py imports csc148_queue.py (used to build larger trees more easily)
-
Week 6: Wed 11 Feb
- Worksheet: Writing a contains function
-
Week 7: Mon 23 Feb and Wed 25 Feb
- tree.py, including code for contains
- Slides: Trees
- btnode.py: node class for a binary tree
- bt_functions.py: some functions on binary tree
- Exercise: evaluating an arithmetic expression that is represented as a binary tree. (We didn't have time to do this in class, but you may find it good practise.)
-
Week 8
- Wednesday announcements
- Linked list slides
- Linked list code: node.py
-
Week 9: Mon 9 March
- announcements
- Worksheet: Writing BST insert and delete
- BST insert and delete code: bst_mutations.py
-
Week 9: Wed 11 March
- Midterm, in EX100
-
Week 10: Mon 16 March
- Slides Looking back at A2
- Worksheet: testing minimax
- Code for testing minimax: minimax_test.py
- Code to demonstrate a common problem with tippy's apply_move: deep-copy.txt. Make sure you deeply understand this (pun intended!).
- Code we'll trace: callstack.py
- Slides assertions
-
Weeks 11 and 12:
- Slides Time efficiency and big-oh
- Binary search on a Python list: sorted_list.py
- Worksheet: Tree height
- Code for big-oh analysis: code.py (solutions are in the comments)
- Slides Course Wrap-up