// Path: src/main/java/org/jheaps/Constants.java
// public class Constants {
// 
//     /**
//      * Library name
//      */
//     public static final String NAME = "JHeaps";
// 
//     /**
//      * Global debug flag which affects compiled code
//      */
//     public static final boolean DEBUG = false;
// 
//     /**
//      * Global level one debug flag which affects compiled code.
//      */
//     public static final boolean DEBUG_LEVEL1 = false;
// 
//     /**
//      * Global level two debug flag which affects compiled code
//      */
//     public static final boolean DEBUG_LEVEL2 = false;
// 
//     /**
//      * Global benchmarking flag. This flag enables sanity checks when the code
//      * is not for benchmarking performance. When benchmarking we assume that the
//      * user provided the correct input.
//      */
//     public static final boolean NOT_BENCHMARK = true;
// 
//     private Constants() {
//     }
// 
// }


import java.io.Serializable;
import java.util.BitSet;
import java.util.Comparator;
import java.util.NoSuchElementException;
import org.jheaps.Constants;
import org.jheaps.annotations.ConstantTime;
import org.jheaps.annotations.LinearTime;
import org.jheaps.annotations.LogarithmicTime;
     * @throws IllegalArgumentException
     *             in case the array is null
     */
    @LinearTime
    public static <K> BinaryArrayWeakHeap<K> heapify(K[] array, Comparator<? super K> comparator) {
        if (array == null) {
            throw new IllegalArgumentException("Array cannot be null");
        }
        if (array.length == 0) {
            return new BinaryArrayWeakHeap<K>(comparator);
        }

        BinaryArrayWeakHeap<K> h = new BinaryArrayWeakHeap<K>(comparator, array.length);

        System.arraycopy(array, 0, h.array, 0, array.length);
        h.size = array.length;

        for (int j = h.size - 1; j > 0; j--) {
            h.joinWithComparator(h.dancestor(j), j);
        }

        return h;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    @ConstantTime
    public K findMin() {
// Path: src/main/java/org/jheaps/Constants.java
// public class Constants {
// 
//     /**
//      * Library name
//      */
//     public static final String NAME = "JHeaps";
// 
//     /**
//      * Global debug flag which affects compiled code
//      */
//     public static final boolean DEBUG = false;
// 
//     /**
//      * Global level one debug flag which affects compiled code.
//      */
//     public static final boolean DEBUG_LEVEL1 = false;
// 
//     /**
//      * Global level two debug flag which affects compiled code
//      */
//     public static final boolean DEBUG_LEVEL2 = false;
// 
//     /**
//      * Global benchmarking flag. This flag enables sanity checks when the code
//      * is not for benchmarking performance. When benchmarking we assume that the
//      * user provided the correct input.
//      */
//     public static final boolean NOT_BENCHMARK = true;
// 
//     private Constants() {
//     }
// 
// }


// Path: src/main/java/org/jheaps/array/BinaryArrayWeakHeap.java
import java.io.Serializable;
import java.util.BitSet;
import java.util.Comparator;
import java.util.NoSuchElementException;
import org.jheaps.Constants;
import org.jheaps.annotations.ConstantTime;
import org.jheaps.annotations.LinearTime;
import org.jheaps.annotations.LogarithmicTime;

     * @throws IllegalArgumentException
     *             in case the array is null
     */
    @LinearTime
    public static <K> BinaryArrayWeakHeap<K> heapify(K[] array, Comparator<? super K> comparator) {
        if (array == null) {
            throw new IllegalArgumentException("Array cannot be null");
        }
        if (array.length == 0) {
            return new BinaryArrayWeakHeap<K>(comparator);
        }

        BinaryArrayWeakHeap<K> h = new BinaryArrayWeakHeap<K>(comparator, array.length);

        System.arraycopy(array, 0, h.array, 0, array.length);
        h.size = array.length;

        for (int j = h.size - 1; j > 0; j--) {
            h.joinWithComparator(h.dancestor(j), j);
        }

        return h;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    @ConstantTime
    public K findMin() {
        if (Constants.NOT_BENCHMARK && size == 0) {