All pastes #595075 Raw Edit

Something

public java v1 · immutable
#595075 ·published 2007-06-29 09:06 UTC
rendered paste body
the method receives a root node of a binary tree and should return the sum of all node's itemsthat are bigger than the number n (I did it with double, but it can be ints just the same)static double sumOfBiggerThan(TreeNode node, double n) {            if (node == null) return 0;            double temp = 0;            if (node.item > n) temp = n;            temp += sumOfBiggerThan(node.left, n);            temp += sumOfBiggerThan(node.right, n);            return temp;}