This file contains hidden or 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
/*This is a helper function, returns 10**exp | |
*/ | |
public static int power_ten(int exp){ | |
if(exp == 0) return 1; | |
else return 10*power_ten(exp-1); | |
} | |
/* | |
Given two strings, representing integers, calculate their product. | |
This works approximately quadratic time, considering the number of digits in both s1 and s2 are equal. | |
*/ |
This file contains hidden or 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
public static int[] firstQPrimes(int q) { | |
/* | |
* Write your code here. | |
*/ | |
// Generar primeros q numeros primos con la criba de atkin | |
//hay 1229 numeros primos entre 1 y 10000 | |
int limit = q; | |
boolean sieve[] = new boolean[limit]; | |
if(limit > 2) sieve[2] = true; | |
if(limit > 3) sieve[3] = true; |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
''' Importar bibliotecas''' | |
import keras | |
from keras.preprocessing import image | |
from keras.applications.vgg16 import VGG16 | |
from keras.applications.vgg16 import preprocess_input | |
from sklearn.model_selection import train_test_split | |
import numpy as np | |
from keras.models import Sequential |
This file contains hidden or 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
static int find(int x,HashMap<Integer,Integer> parent){ | |
if(parent.get(x) == x) return x; | |
return find(parent.get(x),parent); | |
} | |
static int union(int x,int y,HashMap<Integer,Integer> parent, HashMap<Integer,Integer> size,int max1) { | |
int x_p = find(x,parent); | |
int y_p = find(y,parent); | |
int max = max1; | |
if(x_p != y_p){ | |
if(size.get(x_p) > size.get(y_p)){ |
This file contains hidden or 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
class TrieNode { | |
//left y right | |
TrieNode[] children = new TrieNode[2]; | |
public void add_(int s,int bits){ | |
add(s,bits-1); | |
} | |
public TrieNode getNode(int pos){ | |
return children[pos]; |
This file contains hidden or 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
class TrieNode{ | |
public static int ALPHABET_SIZE = 26; | |
TrieNode[] children = new TrieNode[ALPHABET_SIZE]; | |
int size = 0; | |
public int charIndex(char c){ | |
return c - 'a'; | |
} | |
public TrieNode getNode(char c){ | |
return children[charIndex(c)]; |
This file contains hidden or 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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
#Operaciones sobre diccionarios | |
import operator | |
from random import randint | |
#Importa el dataframe y lo guarda en un diccionario | |
def load_data(filename): |
This file contains hidden or 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
Dia | Cielo | Temperatura | Humedad | Viento | Jugar_tenis | |
---|---|---|---|---|---|---|
1 | Sol | Alta | Alta | Debil | No | |
2 | Sol | Alta | Alta | Fuerte | No | |
3 | Nubes | Alta | Alta | Debil | Si | |
4 | Lluvia | Suave | Alta | Debil | Si | |
5 | Lluvia | Baja | Normal | Debil | Si | |
6 | Lluvia | Baja | Normal | Fuerte | No | |
7 | Nubes | Baja | Normal | Fuerte | Si | |
8 | Sol | Suave | Alta | Debil | No | |
9 | Sol | Baja | Normal | Debil | Si |
This file contains hidden or 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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import random | |
DOMAIN = [-10,10] | |
MAX_GENERATIONS = 100 | |
PROB_MUTATE = 0.05 | |
POP_SIZE = 100 |
This file contains hidden or 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
3D Printing | |
Abejas | |
Acolchado | |
Acrobacias Con Bicicletas | |
Acting | |
Actividades De La Iglesia | |
Actividades Informáticas | |
Actuacion | |
Actuar En Teatro | |
Acuarios |
NewerOlder