Frage im Vorstellungsgespräch bei Groupon

Find the 'leftmost' node in a binary tree.

Antwort im Vorstellungsgespräch

Anonym

10. Juli 2020

1. Start with the root node 2. Do in order search but without the right and root traversal 3. Node inorder(Node node) { if(node == null) { return null; } Node leftNode = inorder(node.left); if(leftNode== null) { return node } else { return leftNode; } } 4. print inorder(root);