Skip to content

Instantly share code, notes, and snippets.

@johntbates
johntbates / BinaryHeap.java
Created December 17, 2012 00:11
Binary heaps - part two
package heap;
import java.util.ArrayList;
import java.util.Collection;
public abstract class BinaryHeap<T extends Comparable<T>> {
private ArrayList<T> theHeap;
private final int sign;
@johntbates
johntbates / BinaryHeap.java
Created December 13, 2012 05:36
Binary heaps
package heap;
import java.util.ArrayList;
public abstract class BinaryHeap<T extends Comparable<T>> {
private ArrayList<T> theHeap;
protected final int left(int i) { return (i << 1) + 1; }
protected final int right(int i) { return (i << 1) + 2; }
@johntbates
johntbates / FirstStep.txt
Created December 12, 2012 22:33
A journey of a thousand miles begins with a single step.
Here's my first github gist. Hopefully, this won't be my last.