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
;;; Original function | |
(define (f n) | |
(cond ((< n 3) n) | |
(else (+ (f (- n 1)) (* 2 (f (- n 2))) (* 3 (f (- n 3))))))) | |
; f | |
(f 0) | |
; 0 | |
(f 1) | |
; 1 |
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
;; Rows and columns start with index 1 | |
(define (pascal row col) | |
(cond ((or (= col 1) (= col row)) 1) | |
(else (+ (pascal (- row 1) col) (pascal (- row 1) (- col 1)))))) | |
;; Test cases | |
(pascal 1 1) | |
; 1 | |
(pascal 13 7) | |
; 924 |
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
import pygraphviz as pgv | |
import networkx as nx | |
nodeCount = 1 | |
G = nx.DiGraph() | |
Ranks = {} | |
def countChange(amount): | |
global G | |
global Ranks |
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
#lang planet neil/sicp | |
(define (append x y) | |
(if (null? x) | |
y | |
(cons (car x) (append (cdr x) y)))) | |
(define (last-pair x) | |
(if (null? (cdr x)) | |
x |
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
# This script is designed to work with ubuntu 16.04 LTS | |
# ensure system is updated and has basic build tools | |
sudo apt-get update | |
sudo apt-get --assume-yes upgrade | |
sudo apt-get --assume-yes install tmux build-essential gcc g++ make binutils git | |
sudo apt-get --assume-yes install software-properties-common | |
# download and install GPU drivers | |
wget "http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.44-1_amd64.deb" -O "cuda-repo-ubuntu1604_8.0.44-1_amd64.deb" |
OlderNewer