Denumerate tree nodes in pre-order
Compute node levels