Ejemplo n.º 1
0
        public void Insert(T key, double value)
        {
            _itemList.Add(key);
            value *= factor;

            if (value > mhd.min() || (value == mhd.min() && _index < mhd.getIndices()[0]))
            {
                mhd.changeMin(_index, value);
            }

            isSort = false;
            _index++;
        }
Ejemplo n.º 2
0
        public static int[] heapSort(MinHeapDouble minHeap)
        {
            int[] newIndices = new int[minHeap.getIndices().Length];
            int   orgsize    = minHeap.size;

            for (int i = 0; i < orgsize; ++i)
            {                                        // Now sort
                newIndices[i] = minHeap.removeMin(); // removeMax places max value at end of heap
            }
            return(newIndices);
        }