public Binomial union(Binomial k1, Binomial k2) {
        Binomial k = new Binomial();
        //valitaan juuri mergen avulla
        k.root = merge(k1, k2);
        if (k.root == null) {
            return k;
        }
        Binomialnode previous = null;
        Binomialnode current = k.root;
        Binomialnode next = current.sibling;
        //yhdistetään keot tarkistamalla, että keossa ei ole kahta samanasteista puuta.
        while (next != null) {
            if (current.degree != next.degree || (next.sibling != null && next.sibling.degree == current.degree)) {
                previous = current;
                current = next;
            } else {
                if (current.value <= next.value) {
                    current.sibling = next.sibling;
                    link(next, current);
                } else {
                    if (previous == null) {
                        k.root = next;
                    } else {
                        previous.sibling = next;
                    }
                    link(current, next);
                    current = next;
                }
            }
            next = current.sibling;
        }
        return k;
    }