Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
| public class AckermannFormula | |
| { | |
| public static long Ackermann(long m, long n) | |
| { | |
| if (m == 0) return (n+1); | |
| else if (n == 0) Ackermann(m-1, 1); | |
| else return Ackermann(m-1, Ackermann(m, n-1)); | |
| } | |
| } |
| public class AckermannFormulaMemoized | |
| { | |
| public static long AckermannMemoized(long m, long n) | |
| { | |
| long ans = 0; | |
| string key = String.Format("{0},{1}", m, n); | |
| if (memory.ContainsKey(key)) { | |
| return memory[key]; | |
| } else { |
| public enum ToyType { Car = 0, House = 1 }; | |
| public static class ToysFactory | |
| { | |
| private static IToy _newToy { get; set; } | |
| public static IToy CreateToy(ToyType type) | |
| { | |
| if (type == ToyType.Car) | |
| { |
| public class TreeNode<T> where T : IComparable<T> | |
| { | |
| public T Value { get; set; } | |
| public TreeNode<T> Left { get; set; } | |
| public TreeNode<T> Right { get; set; } | |
| public TreeNode<T> Parent { get; set; } | |
| } | |
| public static class TreeTraversalIterative | |
| { |
| public class TreeNode<T> where T : IComparable<T> | |
| { | |
| public T Value { get; set; } | |
| public TreeNode<T> Left { get; set; } | |
| public TreeNode<T> Right { get; set; } | |
| public TreeNode<T> Parent { get; set; } | |
| } | |
| public static class TreeTraversalRecursive | |
| { |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
| import itertools | |
| # Microkanren programs are 'goal' functions that take in a | |
| # state and return a stream of states that satisfy the given goal. | |
| # I am interested about microkanren because it presents a logic | |
| # programming kernel which fits into a dynamically typed language. | |
| # Anything could go as a variable, but I wanted names for variables. | |
| class Variable(object): |
| #!/usr/bin/python | |
| ''' | |
| Copyright (c) 2014 John Morris <john@zultron.com> | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is | |
| furnished to do so, subject to the following conditions: |
| # 256 colors | |
| set -g default-terminal "screen-256color" | |
| set -g status-bg colour235 | |
| set -g status-fg white | |
| set -g status-attr bright | |
| set -g status-right-length 50 | |
| set -g status-left-length 50 | |
| # default window title colors |