Adding multidimensional binary trees with multiple directions with a stack guard for timing