Package PamUtils
Class BubbleSort
java.lang.Object
PamUtils.BubbleSort
Class to sort indexes, leaving original data intact.
Copied shamelessly from the code Paul White provided
for the median filter in the Whistle and Moan detector.
- Author:
- Doug Gillespie
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
sortAcending
(double[] data, int[] indices) Bubble sort.static void
sortAcending
(int[] data, int[] indices) Bubble sort.static void
sortAcending
(long[] data, int[] indices) Bubble sort.
-
Constructor Details
-
BubbleSort
public BubbleSort()
-
-
Method Details
-
sortAcending
public static void sortAcending(double[] data, int[] indices) Bubble sort. Sorts both the data and also an array of indices. Data and indices arrays must be the same length. indices array need not be initialised.- Parameters:
data
- input dataindices
- sorted output indices
-
sortAcending
public static void sortAcending(int[] data, int[] indices) Bubble sort. Sorts both the data and also an array of indices. Data and indices arrays must be the same length. indices array need not be initialised.- Parameters:
data
- input dataindices
- sorted output indices
-
sortAcending
public static void sortAcending(long[] data, int[] indices) Bubble sort. Sorts both the data and also an array of indices. Data and indices arrays must be the same length. indices array need not be initialised.- Parameters:
data
- input dataindices
- sorted output indices
-