Skip to content

Instantly share code, notes, and snippets.

View arunma's full-sized avatar

Argon arunma

  • Singapore
View GitHub Profile
@arunma
arunma / KnuthShuffle.java
Created May 31, 2013 12:17
Knuth Shuffle
package com.shuffle;
import static com.sorting.insert.SortUtils.exchange;
import java.util.Random;
public class Shuffle {
public int[] shuffle(int[] input) {
@arunma
arunma / ShuffleTest.java
Created May 31, 2013 12:18
Knuth Shuffle Test
package com.shuffle;
import static com.sorting.insert.SortUtils.arrayToString;
import static org.junit.Assert.assertFalse;
import org.junit.Test;
public class ShuffleTest {
@Test
@arunma
arunma / InsertionSortTest.java
Created May 31, 2013 12:19
Insertion Sort Test
package com.sorting.insert;
import static com.sorting.insert.SortUtils.arrayToString;
import static org.junit.Assert.*;
import org.junit.Test;
public class InsertionSortTest {
@arunma
arunma / SortUtils.java
Created May 31, 2013 12:19
Sort Utils
package com.sorting.insert;
public class SortUtils {
public static boolean less (Comparable a, Comparable b){
return a.compareTo(b)<0;
}
public static boolean less (int a, int b){
@arunma
arunma / MergeSortTest.java
Created May 31, 2013 12:20
Merge Sort Test
package com.sorting.merge;
import static com.sorting.insert.SortUtils.arrayToString;
import static org.junit.Assert.*;
import org.junit.Test;
import com.sorting.insert.InsertionSort;
public class MergeSortTest {
@arunma
arunma / QuickSortBasic.java
Last active December 17, 2015 22:49
Quick Sort Basic
package basics.sorting.quick;
import static basics.sorting.utils.SortUtils.exchange;
import static basics.sorting.utils.SortUtils.less;
import basics.shuffle.KnuthShuffle;
public class QuickSortBasic {
public void sort (int[] input){
@arunma
arunma / QuickSort3Way.java
Last active December 18, 2015 02:49
QuickSort3Way
package basics.sorting.quick;
import static basics.shuffle.KnuthShuffle.shuffle;
import static basics.sorting.utils.SortUtils.exchange;
import static basics.sorting.utils.SortUtils.less;
public class QuickSort3Way {
public void sort (int[] input){
@arunma
arunma / QuickSort3WayTest.java
Created June 5, 2013 13:52
QuickSort3WayTest
package com.sorting.quick._3way;
import static com.sorting.insert.SortUtils.arrayToString;
import org.junit.Test;
public class QuickSort3WayTest {
@Test
public void testQuickSort() {
@arunma
arunma / QuickSortDualPivot.java
Created June 14, 2013 10:56
QuickSortDualPivot
package basics.sorting.quick;
import static basics.shuffle.KnuthShuffle.shuffle;
import static basics.sorting.utils.SortUtils.exchange;
import static basics.sorting.utils.SortUtils.less;
public class QuickSortDualPivot {
public void sort (int[] input){
//input=shuffle(input);
@arunma
arunma / activity.xml
Created November 19, 2013 09:11
activity.xml - Data
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0