This file contains 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 | |
{ |
This file contains 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
open System; | |
open System.Diagnostics; | |
[<EntryPoint>] | |
let main argv = | |
let rec cc amount coins = | |
match (amount, coins) with | |
| (0,_) -> 1 | |
| (_,[]) -> 0 | |
| (amount,_) when amount < 0 -> 0 |
This file contains 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
let memoize2 f = | |
let cache = ref Map.empty | |
fun a b -> | |
match (!cache).TryFind (a,b) with | |
| Some(cv) -> cv | |
| None -> | |
let v = f a b | |
cache := Map.add (a,b) v !cache | |
v | |