I am trying to write a formula to find the depth of a three node tree and having issues doing it.
Each node will have an index number going from top to bottom, left to right.
It will look something like this:
0 / | \ 1 2 3 /|\ /|\ /|\ 4 5 6 7 8 9 101112
(10,11,12 are separate)
Given any of these integers, how can I find which level number it will be on the tree?
I thought it would be something like: d = ceil( log(n) / log(3) )
This is close, but it gets off by the right most number of the level above it. (example: 12 is off by 3, 39 is off by 12, exc...)