Class MergeSort


  • public abstract class MergeSort
    extends java.lang.Object
    An implementation of MergeSort, needs to be subclassed to compare the terms.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.Object[] swapSpace  
      protected java.lang.Object[] toSort  
    • Constructor Summary

      Constructors 
      Constructor Description
      MergeSort()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract int compareElementsAt​(int beginLoc, int endLoc)  
      protected void merge​(int begin, int middle, int end)  
      protected void mergeSort​(int begin, int end)  
      void sort​(java.lang.Object[] array)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • toSort

        protected java.lang.Object[] toSort
      • swapSpace

        protected java.lang.Object[] swapSpace
    • Constructor Detail

      • MergeSort

        public MergeSort()
    • Method Detail

      • sort

        public void sort​(java.lang.Object[] array)
      • compareElementsAt

        public abstract int compareElementsAt​(int beginLoc,
                                              int endLoc)
      • mergeSort

        protected void mergeSort​(int begin,
                                 int end)
      • merge

        protected void merge​(int begin,
                             int middle,
                             int end)