employer cover photo
employer logo
employer logo

National Instruments

Is this your company?

National Instruments Interview Question

Find the average value of a binary tree both recursively and iteratively. Explain why iteratively may be preferred over recursively.

Interview Answers

Anonymous

Oct 20, 2012

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

Anonymous

Mar 3, 2013

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