java.lang.Object
org.magicwerk.brownies.collections.helper.primitive.ByteMergeSort

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

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

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    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
     
    private void
    sort(int from, int to)
     
    static <E> void
     
    static <E> void
    sort(IByteList 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
  • Field Details

  • Constructor Details

    • ByteMergeSort

      private ByteMergeSort(IByteList list)
  • Method Details

    • sort

      public static <E> void sort(IByteList list)
    • sort

      public static <E> void sort(IByteList 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)