Question d’entretien chez Microsoft

Save a tree to an array

Réponses aux questions d'entretien

Utilisateur anonyme

3 juill. 2015

Nodes sons are ine position 2n+1 and 2n+2.

7

Utilisateur anonyme

15 sept. 2015

That solution is good for recursion. Ineffective. How would you implement that solution iteratively?

Utilisateur anonyme

2 févr. 2016

Can you describe more please. what is the purpose? is it tree serialization and deserialization?

Utilisateur anonyme

5 juin 2018

the proposed solution will work for only binary tree. The question does not clarify about it. @Nir, what is a recursion you are referencing? You just traverse the tree in a way you like while keeping track to the "order number" of the element and place it to preallocated array.