Skip to content

Instantly share code, notes, and snippets.

View avegancafe's full-sized avatar

Kyle Holzinger avegancafe

View GitHub Profile
abstract class A
case class A1(in: String) extends A
case class A2(num: Int) extends A
val test1: A = A1("Hello")
val test2: A = A2(1)
def receive (inObj: A) = {
Name: Kyle Holzinger
BUID: U92663004
Date: 11.13.14
Problem 1
The first thing to do is to calculate the number of vertices and edges in graph G. Then, using the Floyd Warshall algorithm with a few minor changes, that is to say you still read from K=0 to K = N, given the following changes it now computes the number of different paths between each pair of vertices:
1. Make a list of counters for each pair of vertices
2. Run the original Floyd Warshall algorithm, however now you keep track of the start and end vertices. For each path discovered, add 1 to that counter.
# Name: Kyle Holzinger
# BUID: U92663004
# Date: 12.15.14
from math import floor
from fractions import gcd
from random import randint
'''
Problem 1
@avegancafe
avegancafe / rtime.sh
Created December 30, 2014 20:40
A bash script for updating the time in Linux using ntpdate
#!/bin/bash
# echo "Hello, world!"
sudo service ntp stop
echo "Updating time..."
sudo ntpdate -s time.nist.gov
sudo service ntp start
@avegancafe
avegancafe / 1.py
Last active August 29, 2015 14:12
size = int(input().rstrip())
def neighbors(i,j):
fin = []
for x in [-1,1]:
if i + x > -1 and i + x < size:
fin.append((i+x,j))
if j + x > -1 and j + x < size:
fin.append((i,j+x))
return fin
@avegancafe
avegancafe / perceptron.py
Created January 13, 2015 19:42
A python implementation of a perceptron.
"""Learning and prediction functions for perceptrons."""
# NAME: Kyle Holzinger
# BUID: U92663004
# DATE: 9.4.14
import common
class NotConverged(Exception):
@avegancafe
avegancafe / min.py
Created February 3, 2015 00:19
A python implementation for finding the minimum of a list.
def min(l):
cur = float('-inf')
for el in l:
if el < cur:
cur = el
return cur
'''
Problem:
The Magic Box (Programming)
It is well known at Palantir that Director of Engineering Khan is a very skilled engineer. What is much
less well known is that he is also a skilled ninja, wizard, and genie. Khan has used his impressive
wizarding power to create a magic box locked with an M by N grid of two wizarding symbols that look
suspiciously like the letters "P" and "T", the initials of Khan's favorite company. The box can only be
unlocked by a given person once in that person's lifetime.
Khan has infused the box with his genie powers so that it grants the opener a number of wishes equal
def subsetsum(array,num):
if num == 0 or num < 1:
return None
elif len(array) == 0:
return None
else:
if array[0] == num:
return [array[0]]
else:
var keys = require('./keys'),
yelp = require('yelp').createClient( keys );
var until = function(n, cb){
return function(){ (--n) || cb(); };
};
module.exports = function (search, zip, cb) {
function search(offset, cb, arr){