Skip to content

Instantly share code, notes, and snippets.

@wohhie
Created July 10, 2021 17:07
Show Gist options
  • Select an option

  • Save wohhie/3747e07dd53cdfabcf650c73a7348207 to your computer and use it in GitHub Desktop.

Select an option

Save wohhie/3747e07dd53cdfabcf650c73a7348207 to your computer and use it in GitHub Desktop.
private int sum_tree_data(Node node){
int x, y;
if (node != null){
x = sum_tree_data(node.left);
y = sum_tree_data(node.right);
return x + y + node.data;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment