Skip to content

Instantly share code, notes, and snippets.

View MrDave1999's full-sized avatar
🏠
Working from home

Dave Roman MrDave1999

🏠
Working from home
View GitHub Profile
@MrDave1999
MrDave1999 / Source.c
Last active June 28, 2019 22:22
Operaciones básicas de una cola.
#include <stdio.h>
#include <stdlib.h>
/*
Este archivo de cabecera proporciona macros para pedir los datos de forma segura.
Enlace: www.github.com/MrDave1999/pscanf.h
*/
#include <pscanf.h>
//En este archivo están las funciones que realizan la operación básica en una cola
@MrDave1999
MrDave1999 / list.cs
Last active July 17, 2019 02:41
Colecciones genéricas en C#
using System;
using System.Collections.Generic;
class ListP
{
private int data;
public int getData() { return data; }
public void setData(int data)
{
this.data = data;
@MrDave1999
MrDave1999 / BBIterative.c
Created July 13, 2019 16:33
Función iterativa donde se implementa una búsqueda binaria.
#include <stdio.h>
#include <stdlib.h>
int BBIterative(int* pv, int data, int size)
{
int first = 0;
int end = size-1;
int medium;
unsigned int i = 0;
while(first <= end)
@MrDave1999
MrDave1999 / bubblesort.h
Last active July 17, 2019 02:23
Implementaciones del algoritmo de la burbuja, de una forma eficiente.
#ifndef _BUBBLESORT_H
#define _BUBBLESORT_H
int BubbleSort(int*const parray, const int size)
{
int count; //contar iteraciones.
int total = 0; //total de iteraciones.
int* i;
int* psize = parray + size;
int aux;
@MrDave1999
MrDave1999 / selectionsort.c
Last active July 24, 2019 00:33
Algoritmo de selección en C
#include <stdio.h>
#define MAX_NUM 50
int SelectionSort(int*const pnum, const int size)
{
int* i = pnum;
int* j;
int* min;
int* psize = pnum + size;
int aux;
@MrDave1999
MrDave1999 / Program.cs
Created July 27, 2019 03:54
Implementación de un método para hacer búsqueda binaria en C#.
using System;
class Program
{
static void Main()
{
int data1;
double data2;
int []arrInt = new int[10]{0, 5, 10, 15, 20, 25, 30, 35, 40, 45};
double []arrFloat = new double[10]{0, 5.5, 10.5, 15.4, 20.5, 25.5, 30.67, 35.98, 40.32, 45.90};
@MrDave1999
MrDave1999 / insertionsort.c
Created July 27, 2019 16:14
Algoritmo de inserción en C
#include <stdio.h>
#define MAX_NUM 50
int InsertionSort(int* const parray, const int size)
{
int aux;
int* i;
int* j;
const int* const psize = parray + size;
const int* const pbegin = parray - 1; //este puntero apunta a la dirección base del arreglo.
@MrDave1999
MrDave1999 / shellsort.c
Last active July 27, 2019 21:58
Algoritmo shell en C
#include <stdio.h>
#define MAX_NUM 50
int ShellSort(int* const parray, const int size)
{
int aux;
int count = 0;
int total = 0;
int* i;
const int* const psize = parray + size;
@MrDave1999
MrDave1999 / Alphabet.cs
Last active August 9, 2019 19:48
Programa que detecta la cantidad de veces que una letra, pueda aparecer en una oración.
using System;
class Alphabet
{
private char[]abc = new char[26];
private int[] countUpper = new int[26];
private int[] countLower = new int[26];
public Alphabet()
{
@MrDave1999
MrDave1999 / quicksort.c
Created August 16, 2019 23:19
Algoritmo quicksort en C
#include <stdio.h>
#define MAX_NUM 50
void quicksort(int* const a, int begin, int end)
{
int i, j, medium, aux;
int pivote;
medium = (begin + end) / 2;
pivote = a[medium];