map divider creates array from tree with dfs