So basically i know how BST tree works theoretically but i don't understand how how it operates after the 2nd number is entered in the following code when another data is entered it how can it make a new node and comeback to if statement since after 1st node temp value is not NULL so it shouldn't work
Please can someone explain how this code works http://tinypic.com/r/11m97c6/8
> since after 1st node temp value is not NULL
`temp' lives only in the scope of the function.
I suggest you to make a step-by-step run and look at the call stack.
The idea is that you'll traverse the tree until you find a leaf (temp==NULL)
> temp->LTree = Insert(temp->LTree, num);
note the error prone repetition.
If `temp->LTree' is a leaf, it will point to the new node allocated by `Insert()'
If it is not a leaf, then its value does not change