Programming Threaded Binary Tree Assignment Instructions 5776863146011443
Programming Threaded Binary Tree Assignment Instructions 5776863146011443
Page 1 of 5
CSIS215
Page 2 of 5
CSIS215
Put all your files into a single zip file and submit it to Canvas.
Tips
This is a deceptively challenging project. Do not wait until the last minute to start working on it
or you will go crazy (and probably not succeed in finishing your project). I recommend that you
Page 3 of 5
CSIS215
start with your Word document and describe your implementation approach and then use that to
guide your actual implementation.
Break the project into pieces and think about how you are going to accomplish each piece. Start
by getting the BST files I’ve given you running before making any changes to them and be sure
you understand how the author has implemented his BST. Then add your Boolean instance
variables to the BSTNode.h file and implement your setter/getter methods for your threads.
Next start thinking about inserthelp. You pretty much have to gut the entire method and start
from scratch. Think about node states and how each state affects the insert operation. For
example the state of root when it is the only node in the tree is left and right child equal NULL.
How will you add a node to root and implement your successor and predecessor pointers? Now
look at the state of the second node. How is it different from the state root was in, and how does
that change future insertions? For me it helps drawing the tree out as I build it, so that I can
visualize what it is I am attempting to do.
Debugging Your Code
A big part of this assignment is debugging your code, so do not expect your instructor to do this
for you. Having completed the pre-requisite courses for this class, you should already have some
experience finding coding errors and fixing them. This class will give you plenty of
opportunities to further refine those skills and you can only do that by wrestling with the
problem. Here are some debugging tips:
Build a little, test a little. Don’t write all your code before you start debugging it. Break
your work into logical chunks that can be compiled and debugged and build them one at a
time. For this project, I would start by compiling and running the files I’ve given you
before you make any changes. Then build your threaded tree a node at a time by
modifying inserthelp and BinNode as necessary and use the debugger to determine
whether or not your pointers and threads are being correctly applied.
Learn to use the debugger if you haven’t already. The debugger allows you to step
through your code one step and a time and see what happens in memory while you’re
doing it. When students come to me with problems, I first try to isolate where the
problem is logically based on what the program is doing and then I use the debugger to
find the actual fault.
Be willing to walk away from your computer and give your mind a rest. I find that the
solution to a problem often comes to me while I am doing something else. I have never
regretted stepping away from my computer to let the problem “percolate” in my mind,
but I have often regretted not doing this. This is one of the reasons you should never wait
till the last minute to start working on your program; by doing that you are not giving
yourself the time to walk away.
Page 4 of 5
CSIS215
Make sure you take full advantage of the debugger in your development environment.
Debuggers are invaluable for examining the state of pointers and variables as they make their
way through the program.
Page 5 of 5