Finding corresponding node in a duplicate binary-tree
I'm not going to provide a code example. 
Your approach would work, and takes time proportional to the size of the tree (i.e., its number of vertices) in the worst-case. This can be improved to only take worst-case time proportional to the depth of the vertex of interest.
If the tree is balanced, there would be an exponential difference in the running times. 

Keep track of the path from the node of interest to the root $r$ of Tree $A$. In particular, for each node  $x \neq r$ of the path, push into a stack $S$ either $L$ or $R$ depending whether $x$ it is the left or right child of its parent. 

Then, start from the root of Tree $B$, iteratively pop from a value $y$ from $S$ and move to the left or right child depending on whether $y=L$ or $y=R$, respectively. The node you're at when the stack is empty is exactly the node you're looking for.