Hello everyone! First post here, so please be gentle.
I am working on a Binary Search Tree for my final project in CS242. At first it didn't seem to bad, and I finished the preorder/inorder/postorder traversals without a hitch.
But now that I'm working on the level order traversals and I'm having a really hard time just starting out.
I got about this far:
But I think I am going about this the completely wrong way. Would you guys recommend doing a recursive call? I did a recursive call for the other traversals, but I wouldn't even know how to start the call on this one.
void SearchTree:: level_by_level()
TreeNode *tmpright, *tmpleft;
tmpright = root->right;
tmpleft = root->left;
while(count < height())
for(int i = 0; i<=count; i++)
for(int j = 0; j<=count; j++)
The reason I made the tmpleft and right is because I was going to go down the tree from the root and then output the node each time. But it doesn't seem like that's going to happen very easily.
I don't want someone to do it, I really just want someone to throw some ideas at me and see if I can get it myself. It's not learning if someone fills it out for me.
Thanks guys, I really appreciate you at least looking at it.