' data ' is input . We need to reverse path from root to data . ' level ' is current level . ' temp ' that stores path nodes . ' nextpos ' used to pick next item for reversing .
static Node reverseTreePathUtil ( Node root , int data , Map < Integer , Integer > temp , int level , INT nextpos ) {