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
def factorialRecursivo(n): | |
assert type(n) is int | |
if n==0: | |
return 1 | |
else: | |
return n*factorialRecursivo(n-1) | |
n = int(input('Ingrese n: ')) |
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
# Módulo para funciones matematicas en los reales | |
# https://docs.python.org/3/library/math.html | |
import math | |
a = float(input("Ingrese a: ")) | |
b = float(input("Ingrese b: ")) | |
c = float(input("Ingrese c: ")) | |
# Comprobar la precondición | |
if b**2-4*a*c>=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
contract Energia2 { | |
address public consumidor; | |
address payable public generador; | |
address public contador; | |
address payable public distribuidora; | |
uint public energiaSolicitada; | |
uint public valorAPagar; | |
event ContratoEstablecido(address consumidor, address productor); |
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
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity ^0.7.0; | |
contract Energia1 { | |
address public consumidor; | |
address payable public generador; | |
address public contador; | |
address payable public distribuidora; | |
uint public energiaSolicitada; |
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
def busquedaBinaria(lista, dato, inicio, fin): | |
"""Búsqueda binario de un dato en una lista. | |
La búsqueda opera recursivamente en el rango entre inicio y fin inclusive | |
""" | |
if inicio>fin: | |
return -1 | |
else: | |
medio = (inicio+fin)//2 |
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
public class BusquedaBinaria { | |
public static int busqueda(int[] d, int clave, int primero, int ultimo) { | |
if (primero>ultimo) { | |
return -1; | |
} | |
else { | |
int medio = (primero+ultimo)/2; | |
if (clave<d[medio]) |
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
import java.util.HashMap; | |
import edu.princeton.cs.algs4.Bag; | |
import edu.princeton.cs.algs4.MinPQ; | |
import edu.princeton.cs.algs4.Queue; | |
import edu.princeton.cs.algs4.SeparateChainingHashST; | |
import edu.princeton.cs.algs4.StdIn; | |
import edu.princeton.cs.algs4.StdOut; | |
public class Hashcodes { |
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
import java.util.NoSuchElementException; | |
import edu.princeton.cs.algs4.Stack; | |
import edu.princeton.cs.algs4.StdIn; | |
import edu.princeton.cs.algs4.StdOut; | |
public class InfijaPostfijaPrefija { | |
static class Node { | |
Double value; |
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
/** | |
* Ejemplos de uso de la tabla de símbolos ordenada | |
* | |
* @author Jorge Londoño | |
* Dataset: https://www.kaggle.com/jealousleopard/goodreadsbooks | |
* | |
*/ | |
import java.util.Date; | |
import java.util.Calendar; |
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
import java.util.Iterator; | |
import edu.princeton.cs.algs4.StdOut; | |
public class ListaSimple<T> implements Iterable<T> { | |
private class Nodo { | |
T item; | |
Nodo sig; | |
} |