Building Binary Tree
Hi guys.. I want to build a Binary Tree (Not Binary Search Tree) which is complete using Linked List.. Any ideas? I have a search function implemented below which returns you a TreeNode pointer if it finds the element. I can't test it out coz I need to insert elements to test it.. How do you implement this insert function?? Any help is greatly appreciated.
//Associated data type can be declared here
TreeNode *left, *right;
TreeNode* InsertNode(TreeNode*T, int x)
//DON'T KNOW HOW TO INSERT!!!!
TreeNode* SearchR(TreeNode* T,int key)
if (key == T->key)
else if (SearchR(T->right,key))
What on earth does that all mean?
Originally Posted by 7heavens