We go to right only when left does not contain given data . This way we make sure that correct path node is stored in temp [ ]
Node left , right = null ; left = reverseTreePathUtil ( root . left , data , temp , level + 1 , nextpos ) ; if ( left == null ) { right = reverseTreePathUtil ( root . right , data , temp , level + 1 , nextpos ) ; }