Skip to content

Instantly share code, notes, and snippets.

View djitz's full-sized avatar

Trijito Santoso djitz

View GitHub Profile
@djitz
djitz / QuickSort.java
Created March 21, 2012 21:23
Quick Sort Algorithm in Java
package com.djitz.sort;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* Quick sort algorithm (simple)
* based on pseudo code on Wikipedia "Quick Sort" aricle
*
@djitz
djitz / MergeSort.java
Created March 19, 2012 13:37
Merge Sort - Java
import java.util.Arrays;
import java.util.Random;
/**
* Merge sort algorithm (Top down)
* based on pseudocode at Wikipedia "Merge sort" article
* @see <a href="http://en.wikipedia.org/wiki/Merge_sort"/>
* @author djitz
*
*/
@djitz
djitz / InsertionSort.pseudo
Created March 15, 2012 13:30
Insertion Sort - Pseudocode
//Array
A = {1...n}
//Sort algorithm
for i = 2 to n
j = i
while j > 1
if A[j] < A[j - 1]
swap A[j] and A[j - 1]
j = j - 1
@djitz
djitz / InsertionSort.java
Created March 15, 2012 13:16
Insertion Sort - Java
import java.util.Arrays;
import java.util.Random;
/**
* Insertion Sort Algorithm.
* @author djitz
*
*/
public class InsertionSort {