Class IntMergeSort


  • public class IntMergeSort
    extends java.lang.Object
    This class implements a stable in-place merge sort.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) IIntList list  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private IntMergeSort​(IIntList list)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private int compare​(int idx1, int idx2)  
      private int gcd​(int m, int n)  
      private void insertSort​(int from, int to)  
      private int lower​(int from, int to, int val)  
      private void merge​(int from, int pivot, int to, int len1, int len2)  
      private void rotate​(int from, int mid, int to)  
      private void sort()  
      private void sort​(int from, int to)  
      static <E> void sort​(IIntList list)  
      static <E> void sort​(IIntList list, int from, int to)  
      private void swap​(int idx1, int idx2)  
      private int upper​(int from, int to, int val)  
      • Methods inherited from class java.lang.Object

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

      • IntMergeSort

        private IntMergeSort​(IIntList list)
    • Method Detail

      • sort

        public static <E> void sort​(IIntList list)
      • sort

        public static <E> void sort​(IIntList list,
                                    int from,
                                    int to)
      • sort

        private void sort()
      • sort

        private void sort​(int from,
                          int to)
      • compare

        private int compare​(int idx1,
                            int idx2)
      • swap

        private void swap​(int idx1,
                          int idx2)
      • lower

        private int lower​(int from,
                          int to,
                          int val)
      • upper

        private int upper​(int from,
                          int to,
                          int val)
      • insertSort

        private void insertSort​(int from,
                                int to)
      • gcd

        private int gcd​(int m,
                        int n)
      • rotate

        private void rotate​(int from,
                            int mid,
                            int to)
      • merge

        private void merge​(int from,
                           int pivot,
                           int to,
                           int len1,
                           int len2)