public List<List<BinaryNode>> calculate(BinaryNode<Integer> root) {
    if (root == null) {
      throw new IllegalArgumentException("You can't pass a null instance of BinaryNode");
    }
    return calculatePathToLeafs(root, new LinkedList<BinaryNode>());
  }
Recursive algorithm to solve this problem. The complexity order of this algorithm is O(N)
where N is the number of elements in the array in time and space terms.
src/main/java/com/github/pedrovgs/problem38/PathToEveryLeaf.java