org.plasma.common.sort
Class InsertionSort

java.lang.Object
  extended by org.plasma.common.sort.Sorter
      extended by org.plasma.common.sort.InsertionSort

public class InsertionSort
extends Sorter

Insertion sort algorithm Time Complexity: O(n*n) Memory Complexity: O(1) Stable: yes


Constructor Summary
InsertionSort()
           
 
Method Summary
<T extends java.lang.Comparable<? super T>>
void
sort(T[] a)
           
<T> void
sort(T[] a, java.util.Comparator<T> c)
           
 
Methods inherited from class org.plasma.common.sort.Sorter
swap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InsertionSort

public InsertionSort()
Method Detail

sort

public <T extends java.lang.Comparable<? super T>> void sort(T[] a)
Specified by:
sort in class Sorter

sort

public <T> void sort(T[] a,
                     java.util.Comparator<T> c)


Copyright © 2013. All Rights Reserved.