This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package selectionsort; | |
public class SelectionSort | |
{ | |
public static void Selection_Sort( int array[] ) | |
{ | |
int hold; | |
int index; | |
for ( int i = 0; i < array.length - 1; i++ ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package insertion.sort; | |
public class InsertionSort | |
{ | |
public static void Insertion_Sort( Integer[] A ) | |
{ | |
int key; | |
int i; | |
for ( int j = 2; j < A.length; j++ ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package counting.sort; | |
public class CountingSort | |
{ | |
public static int maximumElement( Integer array[] ) | |
{ | |
// Set the largest element to the first for comparison | |
int max; | |
max = array[ 1 ]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QUICKSORT( A, left, right ) | |
if left < right | |
pivot = PARTITION( A, left, right ) | |
QUICKSORT( A, left, pivot - 1 ) | |
QUICKSORT( A, pivot + 1, right ) | |
PARTITION( A, left, right ) | |
pivot = A[ right ] | |
i = left - 1 | |
for j = left to right - 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package quicksort; | |
public class QuickSort | |
{ | |
public static int partition( int array[], int left, int right ) | |
{ | |
// Create the pivot by picking the last spot in the array | |
int pivot_index; | |
int pivot; | |