how hash map work as a global variable in this recursion calling ? becz we are calling this function and it is void type it does not return any thing so how we are printing in main this hash map.
static void verticalOrderPrint(TreeNode root, Map<Integer, Integer> m, int d) {
if (root == null) {
return;
}
if (!m.containsKey(d)) {
m.put(d, root.data);
}
verticalOrderPrint(root.left, m, d - 1);
verticalOrderPrint(root.right, m, d + 1);
}