First calculate nodes for leaves present at height h
int i = X ; while ( nodes_last_level > 1 && i > 0 ) { nodes_last_level = ceil ( ( float ) nodes_last_level / ( float ) 2 ) ; i -- ; } from_leaf = nodes_last_level ;