Skip to content

Instantly share code, notes, and snippets.

View schweigert's full-sized avatar
🥝
λxy.x

Marlon Henry Schweigert schweigert

🥝
λxy.x
View GitHub Profile
@schweigert
schweigert / Ruas de Joinville.json
Created October 27, 2017 19:19
Ruas de Joinville adicionadas em um JSON
// Carlos Eduardo Cuzik
// Marlon Henry Schweigert
[
{
"value": "place",
"synonyms": [
"rua",
"estrada",
"avenida"
require 'unionf'
include Unionf
nodes = [
:vinho,
:vermelho,
:preto,
:laranja,
:verde,
:amarelo,
require 'unionf'
include Unionf
nodos = [:udesc, :matheus, :marlon, :exemplo_man]
conjunto = UnionFind.new nodos
# Curtem a página UDESC
conjunto.union :udesc, :matheus
conjunto.union :udesc, :marlon
conjunto.union :udesc, :exemplo_man
require 'unionf'
include Unionf
nodos = [1,2,3,4,5]
conjunto = UnionFind.new nodos
lista_adj = {
1 => [2],
2 => [1,3],
3 => [2],
4 => [5],
require 'unionf'
include Unionf
nodos = [1,2,3,4,5]
conjunto = UnionFind.new nodos
lista_adj = {
1 => [2,4],
2 => [1,3,5],
3 => [2],
4 => [1,5],
# Factorial function
def fat n
puts("buscando fat(#{n})")
return 1 if n == 1 or n == 0
f = findFat(n)
if f == nil
f = fat(n-1)*n
insertFat n, f
return f
end
# Factorial function
def fat n
puts("buscando fat(#{n})")
return 1 if n == 1 or n == 0
f = findFat(n)
if f == nil
f = fat(n-1)*n
insertFat n, f
return f
end
def fat n
return 1 if n == 0
return n*fat(n-1)
end
def sfat n
return 1 if n == 0
return fat(n)*sfat(n-1)
end
CREATE SCHEMA `superfactorial` ;
CREATE TABLE `superfactorial`.`fat` (
`n` INT NOT NULL,
`f` LONGTEXT NOT NULL,
PRIMARY KEY (`n`));
CREATE TABLE `superfactorial`.`sfat` (
`n` INT NOT NULL,
`f` LONGTEXT NULL,
apt-get install mysql-client mysql-server libmysql2client-dev
apt-get install ruby-mysql2
gem install mysql2