u6
Class HeapSort

java.lang.Object
  |
  +--u6.HeapSort

public class HeapSort
extends java.lang.Object
implements upr.utils.SortObject


Constructor Summary
HeapSort()
           
 
Method Summary
 void bottomUp(upr.utils.Item[] items, java.util.Comparator cmp, int sInx)
          Constructs the items of the subarray starting from loInx, i.e. items[sInx..size - 1] into the heap container.
protected  void downBubbling(upr.utils.Item[] items, java.util.Comparator cmp, int index)
          Locally restores the order-property at the node with the given (absolute) index and the given last node.
 void sort(upr.utils.Item[] items, java.util.Comparator cmp)
           
protected  void swap(upr.utils.Item[] items, int i, int j)
          Swaps the elements with index i and j.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HeapSort

public HeapSort()
Method Detail

sort

public void sort(upr.utils.Item[] items,
                 java.util.Comparator cmp)
Specified by:
sort in interface upr.utils.SortObject

bottomUp

public void bottomUp(upr.utils.Item[] items,
                     java.util.Comparator cmp,
                     int sInx)
Constructs the items of the subarray starting from loInx, i.e. items[sInx..size - 1] into the heap container.

downBubbling

protected void downBubbling(upr.utils.Item[] items,
                            java.util.Comparator cmp,
                            int index)
Locally restores the order-property at the node with the given (absolute) index and the given last node.

swap

protected void swap(upr.utils.Item[] items,
                    int i,
                    int j)
Swaps the elements with index i and j.