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
| #include <stdio.h> | |
| #include "tiempo.h" | |
| void Seleccion(int * A, int n){ | |
| int temp,k,i,p; | |
| for(k=0; k < n-1; k++){ | |
| p = k; | |
| for(i= k+1; i<n; i++) | |
| if(A[p] > A[i]) p = i; | |
| if(p != k){ |
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
| #include <stdio.h> | |
| #include "tiempo.h" | |
| void Insercion(int * A, int n){ | |
| int j,i,temp; | |
| for(i=0; i<n; i++){ | |
| temp = A[i]; | |
| j = i-1; | |
| while(A[j] > temp && j >= 0){ | |
| A[j+1] = A[j]; |
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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include "tiempo.h" | |
| void salida(int a, int b, int c){ | |
| printf("Los numeros ordenados quedan: %d > %d > %d\n",a,b,c); | |
| } | |
| void Ordena(int a, int b, int c){ | |
| if(a>b) |
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
| #include <stdio.h> | |
| #include "tiempo.h" | |
| void BurbujaMejorada(int * A, int n){ | |
| int i,j,temp; | |
| for(i=0; i<n; i++) | |
| for(j=0; j<i; j++) | |
| if(A[i] < A[j]){ | |
| temp = A[j]; | |
| A[j] = A[i]; |
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
| #include <stdio.h> | |
| #include "tiempo.h" | |
| void BurbujaSimple(int * A, int n){ | |
| int i,j,temp; | |
| for(i=0; i<n; i++) | |
| for(j=0; j<n-1; j++) | |
| if(A[j] > A[j+1]){ | |
| temp = A[j]; | |
| A[j] = A[j+1]; |
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
| #include<stdio.h> | |
| #include "tiempo.h" | |
| int MaximoComunDivisor(int m, int n){ | |
| int a,b, residuo; | |
| if(m>n){ a=m; b=n; } else { a=n; b=m; } | |
| residuo = 1; | |
| while(residuo > 0){ | |
| residuo = a % b; | |
| a = b; |
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
| #include<stdio.h> | |
| #include "tiempo.h" | |
| void OrdenamientoIntercambio(int * A, int n){ | |
| int i,j,temp; | |
| for(i=0; i<n; i++) | |
| for(j=i+1; j<=n; j++) | |
| if(A[j] < A[i]){ | |
| temp = A[i]; | |
| A[i] = A[j]; |
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
| #include<stdio.h> | |
| #include "tiempo.h" | |
| int Producto2Mayores(int * A, int n){ | |
| int i,mayor1,mayor2; | |
| if(A[1] > A[2]) { | |
| mayor1 = A[1]; | |
| mayor2 = A[2]; | |
| } | |
| else{ |
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
| ---------------------------------------------------------------------------------- | |
| -- NOMBRES: | |
| -- Aguero Garcia Harold Sady | |
| -- Lara Hernandez Ricardo Luis | |
| -- GRUPO: 2CV6 | |
| -- Practica 1 "Funcionamineto se ISE" | |
| ---------------------------------------------------------------------------------- | |
| library IEEE; | |
| use IEEE.STD_LOGIC_1164.ALL; |
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
| //Ejemplo de medición de tiempo en C y recepción de parametros en C bajo UNIX | |
| //Compilación de la libreria: "gcc -c tiempo.c " (Generación del código objeto) | |
| //***************************************************************** | |
| //***************************************************************** | |
| //Librerias incluidas | |
| //***************************************************************** | |
| #include <sys/resource.h> | |
| #include <sys/time.h> |