Tree decisionTreeLearning(List<List<Integer>> examples, List<Integer> attributes,
            List<List<Integer>> parentExamples, boolean randImp) {
        Tree tree;
        //    if examples is empty then return PLURALITY-VALUE(parent examples)
        if (examples == null || examples.size() == 0) return new Tree(pluralityValue(parentExamples));
            //    else if all examples have the same classification then return the classification
        else if (sameClassification(examples)) return new Tree(examples.get(0).get(examples.get(0).size() - 1));
            //    else if attributes is empty then return PLURALITY-VALUE(examples)
        else if (attributes == null || attributes.size() == 0) return new Tree(pluralityValue(examples));
        else {
            //  add a branch to tree with label (A = vk) and subtree subtree
            int A; // the best tree
            //        A (best) ← argmaxa ∈ attributes IMPORTANCE(a, examples)
            if (randImp) A = (int) randomImportance(attributes);
            else A = (int) Math.round(gainImportance(attributes, examples));
            //        tree ← a new decision tree with root test A (best)
            tree = new Tree(A);
            attributes.remove((Integer) A);
            //                        System.out.println(attributes.size());
            //        for each value vk of A (best) do
            for (int i = 1; i < 3; i++) {
                //            exs ←{e : e∈examples and e.A = vk} {elements of examples with best = vk }
                List<List<Integer>> exs = new ArrayList<>();
                for (List<Integer> example : examples) {
                    if (example.get(A) == i) exs.add(example);
                }
                //            subtree ← DECISION-TREE-LEARNING(exs, attributes − A, examples)
                Tree subTree = decisionTreeLearning(exs, attributes, examples, randImp);
                tree.addChild(i, subTree);
            }
        }
        return tree;
    }