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
namespace ImmutableDatastructures | |
{ | |
public interface IImmutableStack<T>{ | |
IImmutableStack<T> Push(T value); | |
IImmutableStack<T> Pop(); | |
T Head{get;} | |
IImmutableStack<T> Tail{ get;} | |
int Size{get;} | |
bool IsEmpty(); |
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 racket | |
(define (get-triangle row) | |
(cond | |
( ( = row 0) 0) | |
( ( = row 1) 1) | |
( else (+ row (get-triangle (sub1 row)) )))) | |
(define (nth-perfect-square count) | |
(cond |
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.Linq; | |
namespace ConsoleApplication1 | |
{ | |
public interface IMemoizationPolicy | |
{ |
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; | |
namespace ConsoleApplication1 | |
{ | |
public static class FunctionalExtensions | |
{ | |
public static Func<TResult> Curry<TArg1, TResult>(this Func<TArg1, TResult> func, TArg1 arg1) |
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 <iostream> | |
template<int N> | |
class quick_find{ | |
public: | |
quick_find() | |
{ | |
for(int i =0; i < N; ++i){ | |
elements[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
#include <iostream> | |
template<int N> | |
class quick_union{ | |
public: | |
quick_union() | |
{ | |
for(int i =0; i < N; ++i){ | |
elements[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
#include <iostream> | |
template<int N> | |
class quick_union{ | |
public: | |
quick_union() | |
{ | |
for(int i =0; i < N; ++i){ | |
elements[i] = i; | |
sizes[i] = 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
#include <iostream> | |
template<class T> | |
T three_sum(T values[], int N){ | |
T count = T(); | |
for(int i = 0; i < N; ++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
#include <iostream> | |
#include <stack> | |
#include <stdexcept> | |
#include <cctype> | |
#include <cstdlib> | |
using namespace std; | |
int evaluate(string const &expression){ | |
stack<char> operators; |
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; | |
namespace Synergy | |
{ | |
public class Unit | |
{ | |
public static Unit Empty() | |
{ | |
return new Unit(); |