All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jdsl.core.algo.sorts.ArrayBubbleSort

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

public class ArrayBubbleSort
extends Object
implements SortObject

Constructor Index

 o ArrayBubbleSort()

Method Index

 o sort(Sequence, Comparator)
Perform a bubble-sort, assuming atRank(i) is O(1) -- i.e.

Constructors

 o ArrayBubbleSort
 public ArrayBubbleSort()

Methods

 o 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.


All Packages  Class Hierarchy  This Package  Previous  Next  Index