private void modifyBSTwithgreaterelementssum(Node node, int[] sum) {
if(node == null)
return;
modifyBSTwithgreaterelementssum(node.right, sum);
sum[0]+=node.data;
node.data = sum[0];
modifyBSTwithgreaterelementssum(node.left, sum);
}
how this function replace node with greater element??
in this function we pass sum and node as recursive call and after calling it changes the sum[0] value but function does not return any thing when recursive call complete then previous function sum value is not change, why it is change?