Question : why does this code work for first minimum numbers work when i write the two conditions in one if statement but doesn't work when i
write it in two if statements the two examples are given as follows the first one works and the second doesn't the whole code is given for
easy implementation below.
You already posted before, not sure why you are still posting this again. To find the minimum, you simply branch left in the tree until you get to a null value then the last non-null value encountered is the minimum. The counter business does not make sense, no sense in counting unless you have a balanced BST, then counting might make sense if you want to know the height of the tree.
I am sorry i was in a hurry i did not properly imply that this code is for first 5 minimum numbers that's what the counter is for and yes i did post another thread for minimum value which is the most left leaf , but this is a different
situation where minimum value can also be at the right or left side of the tree