This file contains 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
texto = gets.chomp.upcase #El texto ingresado por el usario se tranforma a mayúscula por facilidad de ejemplificación | |
puts texto | |
recorridos = gets.chomp.to_i # El número de recorridos que cada caracter se desplazara, ya se a la derecha o a la izquierda | |
# del alfabeto | |
r = 1 # r vale 1 cuando se recorre a la derecha del alfabeto y uno cuando se recorre a la izquierda | |
mensaje = "" # este sera el mensaje cifrado | |
texto.split("").each do |c| | |
if c.eql? " " | |
# ignorar espacios en blanco | |
else |
This file contains 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
/* | |
* Algoritmo que genera n números primos desde n hasta m | |
* */ | |
import ( | |
"fmt" | |
"math" | |
"os" | |
"strconv" | |
) |
This file contains 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
package main | |
import ( | |
"fmt" | |
"os" | |
) | |
/* | |
* Algoritmo de busqueda, determina si un caracter es vocal o no | |
* */ |
This file contains 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
# Ejemplo de la regla del producto de Probabílidad | |
# Con remplazo | |
def reglaProducto(n,m) | |
l = [] | |
for i in 0...n | |
for j in 0...m | |
l.push(m) | |
end | |
end |
This file contains 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
# sea expr una expresion aritmetica obtener su arbol de notación infija | |
@arboles = 0 | |
def centraarbol(n) | |
for i in 1..n | |
print " " | |
end | |
end | |
def imprime_raices(sarbol) | |
centraarbol(@arboles) | |
print sarbol[1][0] |
This file contains 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
# Programa auxiliar | |
aciertos = 1..10 | |
suma = 0.0 | |
class Integer | |
def ! | |
(1..self).inject(:*) | |
end | |
end | |
def combinaciones(n,m) |
This file contains 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
/* Implementación del algoritmo Sørense-Dice para evaluar similitud de cadenas*/ | |
// Función que obtiene bi-grams, conjuto de cadenas de dos letras, de cada | |
// palabra ingresada | |
// Recibe : Una cadena de texto | |
// Obtiene: Un arreglo de cadenas de texto de dos letras. | |
function bi_grams(cadena){ | |
var grams = []; | |
for(var i = 0; i <= cadena.length-2;i++){ | |
var pareja = [cadena[i].toString() + cadena[i+1]].toString(); |
This file contains 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
bool cuadrante(char v,ulong n,ulong m,ulong n2,ulong m2, char [][] grid){ | |
ulong i,j; | |
ulong lim,lim2; | |
lim = 3 * (n+1); | |
lim2 = 3 * (m+1); | |
bool bandera = true; | |
for (i=3*n;i<lim;i++){ | |
for(j=3*m;j<lim2;j++){ | |
if(i != n2 || j!=m2){ | |
if(v == grid[i][j] ){ |
This file contains 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
#!/bin/bash | |
awk '/http/' fuentes_informacion.txt | grep -o 'http[^ ]*'|sort -u | grep -o 'http.*' | sort | uniq | grep -o '.*\.[a-z]*' | sort -u | wc | |
#por Héctor Jacales |
This file contains 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
#dicionarios | |
reverse={"A"=>"Z","B"=>"Y","C"=>"X","D"=>"W","E"=>"V","F"=>"U", | |
"G"=>"T","H"=>"S","I"=>"R","J"=>"Q","K"=>"P","L"=>"O","M"=>"N","N"=>"M", | |
"O"=>"L","P"=>"K","Q"=>"J","R"=>"I","S"=>"H","T"=>"G","U"=>"F","V"=>"E","W"=>"D","X"=>"C","Y"=>"B","Z"=>"A" | |
} | |
texto="vwfxzxrlmvholjfvjfvwzwvhkfvhwvloerwzioljfvhvszzk | |
ivmwrwlvmozvhxfvoz" | |
dec=[] | |
texto.upcase.split("").each do |c| | |
dec.push(reverse[c]) |
OlderNewer