Skip to content

Instantly share code, notes, and snippets.

View RamonLopezEscudero's full-sized avatar

Ramon Lopez Escudero RamonLopezEscudero

  • Universidad de Guanajuato
View GitHub Profile
@RamonLopezEscudero
RamonLopezEscudero / Convex_Hull.py
Created February 10, 2017 00:21
Algoritmo para crear una envolvente convexa
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random as rand
import numpy as np
import matplotlib.pyplot as plt
# -----------------FUNCIONES----------------- #
def turn_right():
@RamonLopezEscudero
RamonLopezEscudero / Range_1D_Tree.py
Last active February 10, 2017 01:45
Búsqueda en rango 1D
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# --------------------------LIBRERIAS-------------------------- #
# ------------------------------------------------------------- #
import random as rand
import matplotlib.pyplot as plt
# ------------------------------------------------------------- #
# ---------------------------CLASES---------------------------- #
class Node:
def __init__(self, val):
@RamonLopezEscudero
RamonLopezEscudero / Queues.c
Last active December 29, 2016 01:09
Colas de prioridad en lenguaje C. Se toma como valor "nulo" al entero negativo -1, esto puede modificarse sin alterar el funcionamiento del programa.
#include <stdio.h>
#include <stdlib.h>
int i, size_queue = 5;
void queue_overflow()
{
printf("Overflow!");
exit(0);
}
@RamonLopezEscudero
RamonLopezEscudero / Linked_Lists.c
Created December 22, 2016 20:26
Implementación de listas enlazadas en C
#include <stdio.h>
#include <stdlib.h>
typedef struct node
{
int data;
struct node *next;
} node_t;
void push_end(node_t **head, int value)
@RamonLopezEscudero
RamonLopezEscudero / Stack.c
Created December 22, 2016 19:41
Implementación de pilas en C
#include <stdio.h>
#include <stdlib.h>
int size_stack = 7;
void print_stack(int *stack, int *top)
{
int i;
for(i = 0; i < *top; i++) printf(" %i ", *(stack + i));
}
@RamonLopezEscudero
RamonLopezEscudero / Max_Heapify.py
Created October 4, 2016 15:16
Rutina Max Heapify iterativa en lenguaje Python 2.7
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def parent(index_query):
index_parent = int(index_query/2)
return index_parent
def left_child(index_query):
index_lchild = (2 * index_query) + 1
return index_lchild
@RamonLopezEscudero
RamonLopezEscudero / Merge_Sort.c
Last active May 2, 2024 20:51
Código del método de ordenamiento "Merge Sort"
#include <stdio.h>
#include <stdlib.h>
void merge(int *array, int p, int q, int r)
{
// Declaracion de variables
int i, j, k;
int n_1 = (q - p) + 1;
int n_2 = (r - q);
int *L, *R;
@RamonLopezEscudero
RamonLopezEscudero / Busqueda_Binaria.c
Created September 9, 2016 07:57
Busqueda binaria de un numero.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void main()
{
int counter = 0;
int size, num, aux, lim_izq, lim_der;
printf("Ingrese el limite superior de la lista: ");
@RamonLopezEscudero
RamonLopezEscudero / Regresion_Lineal.c
Created August 21, 2016 20:50
Regresion lineal simple por mínimos cuadrados
#include <stdio.h>
#include <math.h>
void suma_elem_array(int num_data, int *array_x, int *array_y, float *sum_x, float *sum_y, float *sum_xy,
float *sum_cuad_x, float *sum_cuad_y)
{
/* ---------------------------------- */
int i;
/* ---------------------------------- */
@RamonLopezEscudero
RamonLopezEscudero / L8TIRS_Clip_And_Processing.py
Created July 26, 2016 15:02
Procesamiento de imagen de temperatura Landsat 8. Recorte de la imagen a partir de un shapefile y corrección radiométrica a partir de la información contenida en el fichero de metadatos.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================================================== #
# =============================================================================================================== #
# Importar Librerías
import time
import os
import numpy as np