I have been working on determining the height of a self-balanced binary tree knowing its number of nodes(N) and I came with the formula:
height = ceilling[log2(N+1)], where ceilling[x] is the smallest integer not less than x.
The thing is I can't find this formula on the internet and it seems pretty accurate.
Is there any case of self-balanced binary tree this formula would fail?
What would be the general formula to determine the height of the tree then?