(function(){ window.OpenPopKa = true;}())

Given a binary tree, write a recursive function to return the difference between the sum of all node values at odd levels and sum of all node values at even levels. Define the root node to be at level 1.

[ editor.getValue() ]
if (guess[0] != initEditor) { console.log(guess[0]); window.codeValue = guess[0]; window.progexType= "BTRecurTutor"; window.summexName= "BTgetdiffPROG"; } else { return ""; }

This is probably easier than you think it is.

Just keep track of what level you are on (pass this information down when you make a recursive call).

Sum the values of all nodes, but use the negative of the value for odd level nodes. Just pass back the sum of the node with its children.