Skip to content

Instantly share code, notes, and snippets.

/**
* Simple generic insertion sort implementation. It accepts a list of object that implements Comparable and override compareTo method.
* Usage:
* InsertionSort ms = new InsertionSort();
* List<String> unsortedStrings = ...
* List<String> sortedStrings = ms.insertionSort(unsortedStrings);
*
* class SampleObject implements Comparable<SampleObject>{
* private String value;
* . . .
@Pocos
Pocos / MergeSort.java
Last active December 1, 2017 10:07
Simple generic merge sort implementation. It accepts a list of object that implements Comparable and override compareTo method.
/**
* Simple generic merge sort implementation. It accepts a list of object that implements Comparable and override compareTo method.
* Usage:
* MergeSort ms = new MergeSort();
* List<String> unsortedStrings = ...
* List<String> sortedStrings = ms.mergeSort(unsortedStrings);
*
* class SampleObject implements Comparable<SampleObject>{
* private String value;
* . . .
@Pocos
Pocos / ChemicalEquationParser.java
Last active November 29, 2017 15:45
A simple chemical equations parser that I made for my dad.
/**
* A simple chemical equations parser that I made for my dad.
*/
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ChemicalEquationParser {