[   ^ to index...   ]

CSE 143 : 7 Mar 2000

Update 11 Mar: Posted treedemo.cpp demonstrating an inorder iterator for a binary search tree using only a single next pointer.


Homework notes

Destructors
Any time memory is allocated anywhere (particularly in constructors), you have to figure out where it will be deallocated. Otherwise, it is a memory leak.


Heading comments, symbolic constants
Remember the basics of good style. They still apply.


Use virtual
All methods should be virtual, unless you have a good reason. (Remember, destructors should always be virtual.)

Final homework

I will be holding open hours between 10:30 and 12:30, and 1:30-3:30, in the IPL this Thursday. You must show up to get graded. If you want to reserve a specific time for yourself, use the sign-up sheet.

If you absolutely need another time, I may be able to make time on Friday evening. Since most of you have better things to do on Friday evening, I strongly suggest you do it Thursday.

Iterating over binary trees

class Node { public: int value; Node *parent, *left, *right; Iterator getIterator(); }; class Iterator { public: bool hasNext(); Node * next(); };

Solution: see treedemo.cpp


Keunwoo Lee
Last modified: Sat Mar 11 15:29:58 PST 2000