Package PamUtils

Class BubbleSort

java.lang.Object
PamUtils.BubbleSort

public class BubbleSort extends Object
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 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 data
      indices - 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 data
      indices - 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 data
      indices - sorted output indices