The last assignment of the semester has been posted! Get Homework 10 here.
Homework 8 has been posted. Get it here. Use this thread for clarifications as usual.
UPDATE: If you’ve installed before 4/7, you may have to update your mygraph.py and mydigraph.py files to the latest versions, which are in /course/cs016/asgn/projects/hw8/stencil/. Thanks!
The next homework has been posted. This is the last homework before the midterm, so you’ll have a few weeks off! Get it here.
We’ve posted the next homework. Grab it here!
Clarifying questions welcome, but as always please spend time thinking about your problem or question before turning to the blog for a quick answer.
UPDATE: If you would prefer not to test your traversals on your binary tree implementation (in case you have bugs that you cannot fix), we have provided our solution in /course/cs016/lib/bintree.py. It’s not the most elegant solution (so don’t use it as exemplary Python code!) but functionally it works! You can copy it into your hw6 directory if you wish.
We’ve posted the next homework which you can access here. As always, clarifying questions are welcome.
Get started early!
UPDATE: A few of you have raised good questions about the support code for this homework.
- The popup method of the binary tree we provided is meant to help you visualize your tree. Some of you pointed out that if you have two nodes with the same element, the visualizer gets confused. This is true — don’t worry about it — it’s a limitation of the visualization tool. You can print out your tree with
bt = BinTree() print bt
and use assertions as usual to test this case if you’d like.
- A few of you have run into permissions errors when calling popup (on old versions of stencil). This occurs when there is already a graphic generated on your machine, stored in the file /tmp/tmpgraph. This can be fixed by updating your bintree.py file to the latest version of the support code. You can do so by updating the method popup in your bintree.py file with the updated version stored in /course/cs016/asgn/projects/hw5/stencil/bintree.py. (But of course make sure not to overwrite any work you’ve already done.)
- Lastly, the original bt_test.py we provided included a line adding a child to a node by calling addRight directly on the node. This is wrong! You should only ever add children by calling addLeft or addRight on the binary tree in order to keep track of size, height, etc. It’s been updated in the stencil (if you haven’t already installed).
It’s posted! Grab it while it’s hot.
UPDATE: A small bug slipped into our stencil code. In the file queue_test.py, the import statement was wrong. You should be importing from the Python module “queue” (uncapitalized). You can either re-install the HW, or just change the line that reads
from Queue import *
from queue import Queue
We’ve posted the next homework. Get it on the assignments page or here.
Post if you have any questions!