# 19. find corresponding node in two identical DOM tree

JavaScriptShare

easy - accepted / - tried

Given two same DOM tree **A**, **B**, and an Element **a** in **A**, find the corresponding Element **b** in **B**.

By **corresponding**, we mean **a** and **b** have the same relative position to their DOM tree root.

*follow up*

This could a problem on general Tree structure with only `children`

.

Could you solve it recursively and iteratively?

Could you solve this problem with special DOM api for better performance?

What are the time cost for each solution?