This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <string.h> | |
void die(const char *message) | |
{ | |
if(errno) { | |
perror(message); | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Author: Erik Hollembeak | |
;; | |
(defun test-gamegrid-nonsense () | |
"Test out using gamegrid for rendering 2D ASCII world" | |
(require 'cl) | |
(require 'gamegrid) | |
(loop for x from 33 to 57 do | |
(gamegrid-init-buffer 24 24 x) | |
(sit-for 0.4))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FindInBST { | |
public static Node<T> findValueInBST(T value, Node<T> root) { | |
checkNotNull(value); | |
//terminating condition | |
if (root == null) { | |
return null; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Find mode in sorted array | |
/* | |
What types? Let's assume int for now. | |
Bounds on underlying data? No bounds beyond underlying int type | |
Know anything about the distribution. Nope. Anything and everything, but the array is monotonically increasing. | |
What bounds on array size? Let's not concern ourselves. Sufficiently | |
small that we can work with the array in memory. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.tense.interview.arrays; | |
import static com.google.common.base.Preconditions.checkNotNull; | |
public class CircularArrays { | |
/** | |
* Tests for the the complete "circularity" of an array of integers where | |
* traversal is performed by taking array[i] and summing the index i and | |
* value stored in the array to derive a new index. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Source | Target | Type | Id | Weight | Average Degree | |
---|---|---|---|---|---|---|
1 | 3 | Undirected | 1 | 1.0 | 1.0 | |
2 | 10 | Undirected | 8 | 1.0 | 1.0 | |
3 | 4 | Undirected | 2 | 1.0 | 1.0 | |
4 | 5 | Undirected | 3 | 1.0 | 1.0 | |
5 | 10 | Undirected | 4 | 1.0 | 1.0 | |
8 | 2 | Undirected | 7 | 1.0 | 1.0 | |
8 | 9 | Undirected | 11 | 1.0 | 1.0 | |
10 | 1 | Undirected | 5 | 1.0 | 1.0 | |
10 | 6 | Undirected | 10 | 1.0 | 1.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Histogram filter for 2D discrete world | |
# author: Erik Hollembeak | |
colors = [['red', 'green', 'green', 'red', 'red'], | |
['red', 'red', 'green', 'red', 'red'], | |
['red', 'red', 'green', 'green', 'red'], | |
['red', 'red', 'red', 'red', 'red']] | |
measurements = ['green', 'green', 'green', 'green', 'green'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun divisible-by (number list) | |
"return true if divisible by an element in the list" | |
(loop for i in list | |
thereis (= (mod number i) 0))) | |
(defun prime-list-generator (current max-value prime-list) | |
"business end of p10" | |
(if (= current max-value) | |
prime-list | |
(if (divisible-by current prime-list) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(compile-file "euler.lisp") | |
(defun fib (n) | |
(if (or (= n 0) | |
(= n 1)) | |
1 | |
(+ (fib (- n 1)) | |
(fib (- n 2))))) | |
(defun square (number) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
garbageDetector.py | |
Created by Erik Hollembeak on 2009-09-28. | |
Copyright (c) 2009 Vocalocity. All rights reserved. | |
""" | |
import sys |