I have hard time understanding how does it happen. I mean how does :
6
/ \
3 8
/
2
I get that program finds the num on the left side whos equal to null so its smallest and it prints out 2. But how does it go back and prints out 3, 6.I probably didnt understand recursion that well, but if someone could please explain this to me.
Here's function :
void in_order_print(node* p_tree){
if(p_tree != 0){
if(p_tree->p_left != 0)
in_order_print(p_tree->p_left);
cout << p_tree->num<<" ";
if(p_tree->p_left != 0)
in_order_print(p_tree->p_right);
}
}