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
<!-- | |
vim: shiftwidth=2 | |
--> | |
<html> | |
<head> | |
<title>#114: World Ladder Steps</title> | |
</head> | |
<body> | |
<h1>#114: World Ladder Steps</h1> | |
<a href="http://www.reddit.com/r/dailyprogrammer/comments/149kec/1242012_challenge_114_easy_word_ladder_steps/">Reddit Daily Programmer #114</a><br/> |
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
CFLAGS=-ggdb -Wall | |
all: hashmap.out | |
# $< the dependencies | |
# $@ the target | |
hashmap.out: hashmap.o | |
gcc -Wall -ggdb $< -o $@ | |
clean: |
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
CFLAGS=-ggdb -Wall | |
all: is_bst.out | |
# $< the dependencies | |
# $@ the target | |
is_bst.out: is_bst.o | |
g++ -Wall -ggdb $< -o $@ | |
clean: |
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
# | |
# lessons learnt: | |
# | |
# - python's list has no find() method -- the correct name is index() | |
# - next() is a built-in Python function -- http://stackoverflow.com/questions/1733004/python-next-function | |
# | |
def merge(arrays): | |
result = list() | |
while arrays: | |
heads = [a[0] for a in arrays] |
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
def mergesort(array, start, end): | |
if end - start < 2: | |
# | |
# Do nothing. | |
# | |
return | |
half = (end-start)/2 | |
# | |
# Divide and conquer step. | |
# |
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
CFLAGS=-ggdb -Wall | |
all: linkedlist.out | |
# $< the dependencies | |
# $@ the target | |
linkedlist.out: linkedlist.o | |
gcc -Wall -ggdb $< -o $@ | |
clean: |
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 <map> | |
#include <set> | |
#include <algorithm> | |
#include <iostream> | |
using namespace std; | |
// | |
// Lessons learned: | |
// |
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 sys | |
# | |
# Lessons learned: | |
# | |
# - must override object class to get __sizeof__ to work | |
# | |
class TrieNode(object): | |
def __init__(self, leaf): |
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
<!-- | |
vim: shiftwidth=2 | |
--> | |
<html> | |
<head><title>Clobber</title></head> | |
<body> | |
<form> | |
<textarea id="textArea" readonly="true" rows="10" cols="70"></textarea><br/> | |
<input id="inputText" type="text" text="Enter some text here" size="50" value="Enter some Unicode here..."> | |
<input id="checkbox" type="checkbox">clobber the submitted text</input> |
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
<!-- | |
vim: shiftwidth=2 | |
--> | |
<html> | |
<head> | |
<title>Tower of Hanoi</title> | |
</head> | |
<body> | |
<script src="hanoi.js"></script> | |
Number of disks: |
OlderNewer