Class BooleanMergeSort
- java.lang.Object
-
- org.magicwerk.brownies.collections.helper.primitive.BooleanMergeSort
-
public class BooleanMergeSort extends java.lang.Object
This class implements a stable in-place merge sort.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) IBooleanList
list
-
Constructor Summary
Constructors Modifier Constructor Description private
BooleanMergeSort(IBooleanList 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(IBooleanList list)
static <E> void
sort(IBooleanList list, int from, int to)
private void
swap(int idx1, int idx2)
private int
upper(int from, int to, int val)
-
-
-
Field Detail
-
list
IBooleanList list
-
-
Constructor Detail
-
BooleanMergeSort
private BooleanMergeSort(IBooleanList list)
-
-
Method Detail
-
sort
public static <E> void sort(IBooleanList list)
-
sort
public static <E> void sort(IBooleanList 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)
-
-