@@ -0,0 +1,912 @@
+package com.coderevisited.trees.binarytree;%0A%0Aimport java.util.HashMap;%0A%0Apublic class VerticalSum%0A%7B%0A    public static void main(String%5B%5D args)%0A    %7B%0A        BinaryTreeNode root = BinaryTree.buildTree();%0A        printVerticalSum(root);%0A    %7D%0A%0A    private static void printVerticalSum(BinaryTreeNode root)%0A    %7B%0A        HashMap%3CInteger, Integer%3E map = new HashMap%3C%3E();%0A        findVerticalSum(root, map, 0);%0A        System.out.println(map.entrySet());%0A    %7D%0A%0A    private static void findVerticalSum(BinaryTreeNode root, HashMap%3CInteger, Integer%3E map, int index)%0A    %7B%0A%0A        if (root == null)%0A            return;%0A%0A        if (!map.containsKey(index)) %7B%0A            map.put(index, 0);%0A        %7D%0A        int sum = map.get(index);%0A        sum += root.getValue();%0A        map.put(index, sum);%0A        findVerticalSum(root.getLeft(), map, index - 1);%0A        findVerticalSum(root.getRight(), map, index + 1);%0A%0A    %7D%0A%7D%0A

Vertical sum in given Binary Tree