Skip to content

Instantly share code, notes, and snippets.

View wnoizumi's full-sized avatar
:octocat:

Willian Nalepa Oizumi wnoizumi

:octocat:
View GitHub Profile
@wnoizumi
wnoizumi / Hello gist
Created February 27, 2012 14:10
Teste
static class Program
{
static void Main(string[] args)
{
System.Console.Write("Hello gist");
}
}
@wnoizumi
wnoizumi / Main.java
Created March 14, 2012 23:27
Verificador portas
package br.uem.din.verificadorPortas;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.DatagramSocket;
import java.util.ArrayList;
public class Main {
@wnoizumi
wnoizumi / gist:2400104
Created April 16, 2012 17:27 — forked from viniciusteles/gist:556029
Sete Atitudes para Hackear a Indústria de Software
Sete Atitudes para Hackear a Indústria de Software
By Klaus Wuestefeld
1) Torne-se excelente.
Seja realmente bom em alguma coisa. Não fique só choramingando ou
querendo progredir às custas dos outros. Não pense q pq vc sentou 4
anos numa faculdade ouvindo um professor falar sobre software q vc
sabe alguma coisa. Jogador de futebol não aprende a jogar bola tendo
@wnoizumi
wnoizumi / joken_po.rb
Created July 19, 2012 20:57
JokenPo kata using ruby
class JokenPo
@@precedencia = {
:pedra => :tesoura,
:papel => :pedra,
:tesoura => :papel
}
def self.jogar(jogador1, jogador2)
@wnoizumi
wnoizumi / shunting_yard.rb
Created July 26, 2012 19:46
Shunting Yard algorithm
class ShuntingYard
@@op_precedence = {
'+' => 2,
'-' => 2,
'*' => 3,
'/' => 3,
'^' => 4
}
@wnoizumi
wnoizumi / Inversions.java
Last active October 15, 2015 18:38
Java implementation to find the number of inversions in a given array.
public class Inversions {
public static long calcInversions(int[] input) {
if (input.length == 1) {
return 0;
}
long numberOfInversions = 0;
int halfLength = input.length / 2;
int leftLength = halfLength;
int rightLength = halfLength;
class Caixa
attr_reader :peso, :capacidade
def initialize(peso, capacidade)
@peso = peso
@capacidade = capacidade
end
end
class Pilha
def prime?(n)
(2..Math.sqrt(n)).each do |i|
return false if n % 2 > 0
end
return true
end
@wnoizumi
wnoizumi / Prim.cpp
Last active December 18, 2015 07:19
...
fp = fopen(file_input, "r");
...
for (int k = 1; k <= 2*M_arcos; k += 2)
{
fscanf(fp, "%s %d %d %d", line_parse, &i, &j, &w);
I_arco[k] = i;
J_arco[k] = j;
I_arco[k+1] = j;
J_arco[k+1] = i;
lowerBound = MST
upperBound = todos os vértices conectados na raiz
G = (V, E)
e[] = sort(E) //as arestas serão usadas para particionar o espaço de soluções
bestSoFar = upperBound(G)
live[] = branch(e.dequeue()) //aqui gera as possibilidade: 1- com p0, 2 - sem p0