CSC148H: Lectures

Lecture Materials

Information will be updated here after each lecture.

Week Lecture Notes Lecture Files Readings / References
1 (May 14) Notes
Notes (Style Guidelines)
balanced.py
queue.py
stack.py
teststack.py
timestack.py
naivepq.py
1.3, 1.4 (optional), 2.1 - 2.4 (textbook)

First 2 pages of Computer Science and its Relation to Mathematics
(optional - accessible from on campus)

PEP8: Style Guide for Python Code
PEP257: Docstring Conventions
2 (May 21) Notes addressbook.py
contact.py
catch1.py
catch2.py
exception1.py
exception2.py
reraise.py
userexception.py
userexception2.py
vars1.py
See URLs referenced in the Notes.
3 (May 28) Notes classbind.py
enclosing.py
namespaces.py
redefine.py
fact.py
fib.py
hanoi.py
sum.py
Dynamic Typing/Namespaces/Scopes

"Learning Python" by Mark Lutz 3rd edition
Chapter 6, pages 112-121; Chapter 16, pages 310-316

OR

"Learning Python" by Mark Lutz 2nd edition
Chapter 4.6, 13.1, 13.2, 13.3
(As a UofT student you have FREE electronic access to this edition of the book through the UofT library website. All you need is your UTOR id/password).

Python Scopes and Name Spaces

Naming and Binding
(This is from the python language reference and it's rather technical. It contains more than you really need to know.)

Namespaces Tutorial
Recursion

Chapter 3 of your textbook.
4 (June 4) see readings/references for material covered escape.py
water.py
We did some more recursion examples, and also talked about backtracking. This included reviewing the Towers of Hanoi problem from last week, going over the solution for the count_reachable problem from the week 4 lab, and developing recursive functions for finding an escape path out of a maze, and a recursive function for the "Water in Jugs" problem.
5 (June 11) Notes listoflist.py
nodesrefs.py
traversal.py
traversal2.py
5.1 - 5.5 (textbook)
start of 5.6 (Binary search trees)
6 (June 18) Notes bst.py
5.6 (textbook)
7 (June 25) Midterm
Solutions
The midterm was written during lecture. Afterwards, we reviewed solutions.
8 (July 2) Notes bst.py
generator.py
iteration.py
iteration2.py
Iterators and Generators

Python Tutorial: Iterators and Generators


Algorithm Analysis

4.1 - 4.2 (textbook)


The following are slides on Big-Oh and Algorithm Analysis from a previous offering of the course. The slides include some examples in Java, but the syntax isn't drastically different from Python. You may find these slide useful in addition to the material covered in your text and your lecture notes: 08bigoh.pdf
9 (July 9) Notes sorts.py
4.4
4.4.1 (bubble sort)
4.4.2 (selection sort)
4.4.3 (insertion sort)
4.4.5 (merge sort)
10 (July 16) see readings/references for material covered mergesort_it.py
linked_list.py
node.py
sorted_list.py
test_lists.py
We discussed the time complexity of mergesort, and looked at the implementation of iterative mergesort.
We also talked about linked lists (see chapter 7.1-7.2 of your text).
11 (July 23) see readings/references for material covered pqueue.py Heaps - Section 5.7 of textbook.

We started discussing how to implement a priority queue using a min heap.
12 (July 30) see readings/references for material covered heapsort.py qsort.py We finished discussing how to implement a priority queue using a min heap.

We discussed how to build a max heap in-place on a list, and how to use this in conjunction with the percDown helper method to do an in-place heap sort. (See Section 5.7 of textbook. Note, however, that the algorithm presented in class differs slightly from your text.)

We also briefly talked about Quick Sort. (See section 4.4.6 of the text.)
13 (August 6) see readings/references for material covered We went through a number of practice questions, including examples on: Object Oriented Analysis, Trees, Algorithm Analysis, Sorting, and Linked Lists.

"Reference" page (page 17) of exam is here: Reference Page