jdsl.core.algo.sorts
Class ArrayBubbleSort

java.lang.Object
  |
  +--jdsl.core.algo.sorts.ArrayBubbleSort

public class ArrayBubbleSort
extends java.lang.Object
implements SortObject


Constructor Summary
ArrayBubbleSort()
           
 
Method Summary
 void sort(Sequence S, Comparator c)
          Perform a bubble-sort, assuming atRank(i) is O(1) -- i.e.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayBubbleSort

public ArrayBubbleSort()
Method Detail

sort

public void sort(Sequence S,
                 Comparator c)
Perform a bubble-sort, assuming atRank(i) is O(1) -- i.e. the sequence is vector-based.

'i' is an index indicating the beginning of the sorted part of the sequence, which lets the inner loop break when no more swaps will take place. In the inner loop, elements bubble up, with the maximum taking its place at the tail of the unsorted part of the sequence.

Specified by:
sort in interface SortObject
Parameters:
S -  
c -