National Instruments Interview Question: Find the average value of a b... | Glassdoor

Interview Question

Software Engineering Intern I Interview(Student Candidate) Boulder, CO

Find the average value of a binary tree both recursively

  and iteratively. Explain why iteratively may be preferred over recursively.
Answer

Interview Answer

2 Answers

0

Iteratively should theoretically be more efficient. No function calls, uses less memory, etc.

Interview Candidate on Oct 20, 2012
0

method 1 ;
inorder sort
method 2
augmented BST with size as extra data

Ankit on Mar 3, 2013

Add Answers or Comments

To comment on this, Sign In or Sign Up.