@@ -0,0 +1,897 @@
+package com.interview.tree;%0A%0A/**%0A * http://www.geeksforgeeks.org/add-greater-values-every-node-given-bst/%0A * Test cases:%0A * Empty tree%0A * One node tree%0A * Two node tree%0A */%0A%0Aclass IntegerRef%7B%0A%09int val;%0A%7D%0A%0Apublic class AddGreaterValueNodeToEveryNode %7B%0A%0A%09public void add(Node root,IntegerRef ref)%7B%0A%09%09if(root == null)%7B%0A%09%09%09return ;%0A%09%09%7D%0A%09%09add(root.right,ref);%0A%09%09root.data += ref.val;%0A%09%09ref.val = root.data;%0A%09%09add(root.left,ref);%0A%09%7D%0A%09%0A%09public static void main(String args%5B%5D)%7B%0A%09%09BinaryTree bt = new BinaryTree();%0A%09%09Node root = null;%0A%09%09root = bt.addNode(10, root);%0A%09%09root = bt.addNode(5, root);%0A%09%09root = bt.addNode(20, root);%0A%09%09root = bt.addNode(15, root);%0A%09%09root = bt.addNode(25, root);%0A%09%09AddGreaterValueNodeToEveryNode agv = new AddGreaterValueNodeToEveryNode();%0A%09%09IntegerRef ir = new IntegerRef();%0A%09%09ir.val = 0;%0A%09%09agv.add(root, ir);%0A%09%09TreeTraversals tt = new TreeTraversals();%0A%09%09tt.inOrder(root);%0A%09%7D%0A%7D%0A

Adding new question in tree