Domanda di colloquio di Stemly

3. build a tree using recursion

Risposta di colloquio

Anonimo

18 nov 2021

3. use the preorder traversal list and inorder traversal sequence to do that. Take the elements in preorder traversal sequence sequentially as the root, and locate the root in the inorder traversal sequence. The left of the root is the left child and the right of the root is the right child. Build the left and right sub-tree using recursion.