Skip to content

Instantly share code, notes, and snippets.

View SylvanasSun's full-sized avatar

SylvanasSun SylvanasSun

  • Tianjin,China
View GitHub Profile
@SylvanasSun
SylvanasSun / RedBlackBST.java
Created April 2, 2017 09:16
This implements uses a left-leaning red-black binary search tree. It requires that the key type implements Comparable interface and calls the compareTo() method to compare two key. It does not call either equals() or hashCode().
import edu.princeton.cs.algs4.Queue;
import java.util.NoSuchElementException;
import java.util.Scanner;
/**
* The {@code RedBlackBST} class represents an ordered symbol table of generic
* key-value pairs.
* This implements uses a left-leaning red-black Binary Search Tree.
* It requires that the key type implements the {@code Comparable} interface
@SylvanasSun
SylvanasSun / BinarySearchTree.java
Created March 26, 2017 12:13
Using binary search tree implements the symbol table.
package chapter3_searching.C3_2_BinarySearchTrees;
import edu.princeton.cs.algs4.Queue;
import java.util.NoSuchElementException;
import java.util.Scanner;
/**
* The {@code BinarySearchTree} class represents an ordered symbol table of generic
* key-value pairs.
@SylvanasSun
SylvanasSun / MaxPriorityQueue.java
Created March 21, 2017 08:17
Using binary heap implements of the max priority queue.
import java.util.Comparator;
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.Scanner;
/**
* max heap priority queue
*
* @author SylvanasSun
*
@SylvanasSun
SylvanasSun / A.sorting_algorithm
Last active March 20, 2017 12:02
Some common sorting algorithm snippet.
Some common sorting algorithm snippet.
@SylvanasSun
SylvanasSun / 0_reuse_code.js
Created February 20, 2017 09:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console