Skip to content

Instantly share code, notes, and snippets.

package com.abraham.trees;
public class BinarySearchTree<E extends Comparable<E>> extends BinaryTree<E> {
protected Node<E> root;
protected Node<E> nil;
public static void main(String[] args) {
BinarySearchTree<Integer> bt = new BinarySearchTree<Integer>();
public class HeapSort {
public static void sort(int[] a)
{
int heapSize = a.length-1;
buildMaxHeap(a, heapSize);
while (heapSize > 0) {
swap(a, 0, heapSize);
heapSize--;
import java.util.Arrays;
public class QueensBrute {
public static void main(String[] args) {
run();
}
public static void run()
{
public class StackList {
StackListNode first;
int size;
public static void main(String[] args) {
StackList list = new StackList();
list.push(1);
import java.util.Arrays;
import java.util.Comparator;
public class AnonymousComparator {
public static void main(String[] args) {
String[] array = {"car", "apple", "house", "awesome", "breban", "compsci", "yeshiva", "university"};
Arrays.sort(array, new Comparator<String>() {
public class FibStack {
public static void main(String[] args) {
System.out.println(getFib(12));
}
public static int getFib(int n)
{
if (n == 0) return 0;
if (n == 1) return 1;
//----------------------------------------------------
protected void iterativeWalk(Visitor v)
{
Node node = root;
if (node != nil) {
while (node.left != nil) {
node = node.left;
}
@AlexAbraham1
AlexAbraham1 / AppAlert_.gitignore
Created October 5, 2014 03:53
An android application to help with phone addiction
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
the
of
and
to
a
in
for
is
on
that