I'm trying to find a way a way to find the minimum positive ([0, INT\_MAX)) (the largest integer) value not in the **binary search tree**. The tree has all positive integers. I was thinking of traversing down the left side of the tree. Then creating a struct value `struct { int data; bool found; };`, where I return `t/f` if it's the min value.

I did this by traversing the left side, and if the root->data + 1 > left->data, then return the 

> 
> left->data + 1
> 
> 
> 

, otherwise go right. Then if 

> 
> root->data + 1 < right->data
> 
> 
> 

, then `return root->data + 1`. Otherwise return `root->data or right->data` if right is not null, with the found value to be false. I also have to account for if the min value in the tree is not 0, then return 0. I'm not really sure if this is the best way to go though.

Thanks for any help.

Edit: Sorry, I wrote this last night, when I was really tired. I'm using this inside of a loop, so putting it into an array each time would take up too much time. I'm using a binary search tree, so I can do it with only 1 insertion and deletion each time through the loop, with as minimum time spent finding the min value not in the tree.