Skip to content

Instantly share code, notes, and snippets.

💭
That Gibson won't hack itself

Andrew Norton apnorton

💭
That Gibson won't hack itself
Block or report user

Report or block apnorton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@apnorton
apnorton / disjoint_set.py
Created Apr 19, 2017
Disjoint Set Data Structure
View disjoint_set.py
# Referenced (and written for) a question on StackOverflow: http://stackoverflow.com/q/43485892/1110928
import numpy as np
class DisjointSet:
def __init__(self, size):
self.parent = np.arange(size) # parent of tree rooted at index i
self.sz = np.zeros(size) # size of tree rooted at index i
# Finds the root of given element, c, and returns the root
@apnorton
apnorton / compute_score.py
Created May 10, 2016
Copy and paste the results from the autograder into "results.txt" and then run this program.
View compute_score.py
opt_runtimes = {
'cells-40-21' : 4110539 ,
'crm2xu-benchmark1' : 778286 ,
'crm2xu-benchmark2' : 883497 ,
'ctj4t-test1' : 1046270 ,
'ctj4t-test2' : 1164499 ,
'dcb6y-test1' : 841626 ,
'dcb6y-test2' : 858063 ,
'hairy-scary-double': 871919 ,
'hello-world' : 663546 ,
View .vimrc
set shiftwidth =2
set tabstop =2
set softtabstop =2
set backspace =2
set autoindent
set smarttab
set expandtab
set number
set linebreak
View keybase.md

Keybase proof

I hereby claim:

  • I am apnorton on github.
  • I am apnorton (https://keybase.io/apnorton) on keybase.
  • I have a public key whose fingerprint is 773F B9C9 A32E 8CB0 FD43 0CFE 1BD7 8F8D 030E E72D

To claim this, I am signing this object:

View RepPowerLaw.py
import csv
import matplotlib.pyplot as plt
from math import log
def make_plot(x, y, xmin=0, ymin=0, xmax=None, ymax=None, xlabel='X', ylabel='Y'):
# clear the figure
plt.clf()
if xmax is None:
xmax = max(x)
View Recurrence.java
import java.util.*;
//Example recursive functions
public class Recurrence {
public static void main(String[] args) {
//GCD Demonstration
System.out.println("The greatest common divisor of 12 and 8 is " + gcd(12, 8));
System.out.println("The greatest common divisor of 15 and 7 is " + gcd(15, 7));
You can’t perform that action at this time.