@Override
    public List<Integer> sort(List<Integer> list) {

        // checking input parameter for null
        if (list == null) {
            throw new IllegalArgumentException("ArrayList not specified!");
        }

        // building heap
        for (int child = 1; child < list.size(); child++) {
            int parent = (child - 1) / 2;

            // swap child & parent if parent < child
            while (parent >= 0 && list.get(parent).compareTo(list.get(child)) < 0) {
                appUtil.swap(list, parent, child);
                child = parent;
                parent = (child - 1) / 2;
            }
        }
        return shrinkHeap(list);
    }