Skip to content

Instantly share code, notes, and snippets.

View rodrigovidal's full-sized avatar

Rodrigo Vidal rodrigovidal

View GitHub Profile
[EntryPoint]
public static int main(string[] argv)
{
ExtraTopLevelOperators.PrintFormatLine<Unit>((PrintfFormat<Unit, TextWriter, Unit, Unit>) new PrintfFormat<Unit, TextWriter, Unit, Unit, Unit>("2"));
int num = 0;
ExtraTopLevelOperators.PrintFormatLine<Unit>((PrintfFormat<Unit, TextWriter, Unit, Unit>) new PrintfFormat<Unit, TextWriter, Unit, Unit, Unit>("1"));
int a = 0;
ExtraTopLevelOperators.PrintFormatLine<Unit>((PrintfFormat<Unit, TextWriter, Unit, Unit>) new PrintfFormat<Unit, TextWriter, Unit, Unit, Unit>("3"));
int b = 0;
int c = num;
http://sist.sysu.edu.cn/~isslxm/DSA/textbook/Skiena.-.TheAlgorithmDesignManual.pdf
https://github.com/felipecruz/cdats
http://www.amazon.com/Algorithms-Unlocked-Thomas-H-Cormen/dp/0262518805/ref=sr_1_2?ie=UTF8&qid=1372518782&sr=8-2&keywords=cormen
http://www.amazon.com/Introduction-Algorithms-Thomas-H-Cormen/dp/0262033844/ref=sr_1_1?ie=UTF8&qid=1372518782&sr=8-1&keywords=cormen
https://sites.google.com/site/stevenhalim/
@rodrigovidal
rodrigovidal / gist:3893973
Created October 15, 2012 17:53
Oracle manda lembranças
////Isso funciona..
var parametros = new[]
{
new OracleParameter("P_CD_CLIENTE", OracleDbType.Int32)
{ Direction = ParameterDirection.Input, Value = null },
new OracleParameter("C_CURSOR", OracleDbType.RefCursor)
{ Direction = ParameterDirection.Output }
};
////Isso não funciona..
module Ast =
type Node =
| Int of int option
| Float of float option
| BooleanNode of bool option
| StringNode of string option
| QuotedVariable of string
| Variable of string
| Addition of Node * Node
@rodrigovidal
rodrigovidal / gist:2913207
Created June 11, 2012 22:46
Steepest Descent Method
function steepest
% Exemplo 6.2-2 do livro Optimal Control Theory de D.E.Kirk
% Steepest Descent Method
eps = 1e-3;
options = odeset('RelTol', 1e-4, 'AbsTol',[1e-4 1e-4]); %permite ajustar os parametros de integracao para os solvers de EDOs
t0 = 0;
tf = 0.78;
R = 0.1;
step = 0.4;
@rodrigovidal
rodrigovidal / euler1.fs
Created May 9, 2012 01:59
Euler1 (revisado)
let euler1 (limit : int64) =
let limit = bigint (limit-1L)
let sn a1 =
let a1 = bigint (int a1)
let an = (limit / a1 * a1)
let n = an / a1
(an + a1) * n / 2I
sn 3 + sn 5 - sn 15
@rodrigovidal
rodrigovidal / gist:1363351
Created November 14, 2011 05:55
Somar funcional
public int SumNumbers(int from, int to)
{
return from > to ? 0 : (SumNumbers(from + 1, to) + from) ;
}
@rodrigovidal
rodrigovidal / gist:1363274
Created November 14, 2011 04:59
Somar recursivo
private int SumNumbers(int from, int to)
{
if (from > to) return 0;
int sumRest = SumNumbers(from + 1, to);
return from + sumRest;
}
@rodrigovidal
rodrigovidal / gist:1363269
Created November 14, 2011 04:57
Somar imperativo
private int SumNumbers(int from, int to)
{
int res = 0;
for (int i = from; i <= to; i++)
res = res + 1;
return res;
}
let fibonacci =
(0, 1)
|> Seq.unfold(fun (current, next) -> Some(current, (next, current + next)))
|> Seq.takeWhile(fun x -> x <= 4000000)
|> Seq.filter(fun x -> x % 2 = 0)
|> Seq.sum