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 java.io.Serializable; | |
public class TwoAvgProtocol implements Serializable { | |
interface MessageReceiver { | |
public void onHave(double val); | |
public void onAdjust(double delta); | |
} | |
static abstract class Message { |
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 functools | |
import collections | |
import random | |
@functools.lru_cache(maxsize=None) | |
def c(n, k): | |
if k == 0 or k == n: | |
return 1 | |
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
import std.stdio; | |
import std.conv; | |
class Vector(T, int S) { | |
static immutable size = S; | |
T[S] elemets; | |
public this(){ | |
for(int i = 0; i < S; i++) | |
elemets[i] = i; |
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
val p1 = Variable "x"; | |
val p2 = TupleP [Variable "x", Variable "y"]; | |
val p3 = ConstructorP ("Frac", Wildcard); | |
val p4 = ConstructorP ("Frac", ConstP 42); | |
val p5 = ConstructorP ("Comp", Variable "x"); | |
val p6 = ConstructorP ("Comp", TupleP [Wildcard, Wildcard]); | |
val p7 = ConstructorP ("Comp", TupleP [ConstructorP ("Frac", TupleP [Wildcard, ConstP 42]), | |
ConstructorP ("Nat", Wildcard)]); | |
val pt1 = ConstructorP ("Nat", UnitP); |
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 | |
from multiprocessing import Process, Queue | |
from cStringIO import StringIO | |
import gc | |
def memory_safe(f): | |
def g(*args): | |
def h(q, aargs): | |
q.put(f(*aargs)) | |
q = Queue() |
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
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
namespace SuffixTreeAlgorithm | |
{ | |
public class SuffixTree | |
{ |
NewerOlder