com.quadrique.jbuildingblocks.core.dataStructure
Class JbbDataStructure

java.lang.Object
  extended by com.quadrique.jbuildingblocks.core.dataStructure.JbbDataStructure

public class JbbDataStructure
extends Object


Method Summary
 int binarySearch(Comparable[] array, Comparable target)
          Standard Binary Search Algorithm.
 void bubbleSort(Comparable[] arr)
          bubble sort.
 boolean compare(byte[] zArrayIn1, byte[] zArrayIn2)
           
<T> ArrayList<T>
concatenate(ArrayList<T> list1, ArrayList<T> list2)
          Generic method that is used to concatenate 2 lists
 void insertionSort(Comparable[] arr)
          insertion sort.
 void mergeSort(Comparable[] arr)
          mergeSort
static JbbDataStructure newInstance()
           
 void quickSort(Comparable[] arr)
          quicksort
 void selectionSort(Comparable[] arr)
          selection sort.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newInstance

public static JbbDataStructure newInstance()
Returns:
a new instance

concatenate

public final <T> ArrayList<T> concatenate(ArrayList<T> list1,
                                          ArrayList<T> list2)
                               throws Exception
Generic method that is used to concatenate 2 lists

Parameters:
list1 -
list2 -
Returns:
the concatenation of the 2 lists (list2 is added at the end of list1 and list1 is returned)
Throws:
Exception

compare

public final boolean compare(byte[] zArrayIn1,
                             byte[] zArrayIn2)
Parameters:
zArrayIn1 -
zArrayIn2 -
Returns:
true if the 2 arrays have the same length and same values, false otherwise (if at least one of the arrays is null, false is returned)

insertionSort

public void insertionSort(Comparable[] arr)
insertion sort.


bubbleSort

public void bubbleSort(Comparable[] arr)
bubble sort.


selectionSort

public void selectionSort(Comparable[] arr)
selection sort.


quickSort

public void quickSort(Comparable[] arr)
quicksort


mergeSort

public void mergeSort(Comparable[] arr)
mergeSort

Parameters:
arr -

binarySearch

public int binarySearch(Comparable[] array,
                        Comparable target)
Standard Binary Search Algorithm.

Parameters:
array -
target -
Returns:
integer value


Copyright © 2001-2008 Quadrique Corporation. All Rights Reserved.