Está en la página 1de 6

INSTITUTO TECNOLOGICO DE TIJUANA.

DEPARTAMENTO DE SISTEMAS Y COMPUTACIÓN


SEMESTRE: SEPTIEMBRE – ENERO 20/21. ESTRUCTURA DE DATOS SERIE 6SC3A

NOMBRE COMPLETO ALUMNO: Mauricio Chavez Arroyo


UNIDAD A EVALUAR: 5 Introducción a los ordenamientos
TEMA A EVALUAR: Método 1 Intercalación simple
FECHA DE ENTREGA: 28 de Mayo de 2021

REPORTE DE PRACTICA
PROGRAMA FUENTE:
using System;

namespace U5P5
{
class Program
{
//Declaracion del arreglo
private int[] arreglo= new int[17];

//Funcion que organiza el arreglo por el metodo 1 de intercalacion simple


public void Intercalacionsimple()
{
int N = arreglo.Length;
int i, j, izq, der, mitad, auxi;

for (i = 1; i < N; i++)


{
auxi = arreglo[i];
izq = 0;
der = i - 1;

while (izq <= der)


{
mitad = (izq + der) / 2;

if (auxi <= arreglo[mitad])


der = mitad - 1;
else
izq = mitad + 1;
}
INSTITUTO TECNOLOGICO DE TIJUANA. DEPARTAMENTO DE SISTEMAS Y COMPUTACIÓN
SEMESTRE: SEPTIEMBRE – ENERO 20/21. ESTRUCTURA DE DATOS SERIE 6SC3A

j = i - 1;

while (j >= izq)


{
arreglo[j + 1] = arreglo[j];
j--;
}
arreglo[izq] = auxi;
}
}

//Funcion para capturar los sueldos


public void Capturar()
{
for (int i = 0; i < arreglo.Length; i++)
{
Console.Write("Ingrese el sueldo numero " + (i + 1) + ": ");
arreglo[i] = int.Parse(Console.ReadLine());
}
Console.ReadKey();
Console.Clear();

Console.WriteLine("El arreglo desordenado es:");


Console.WriteLine();
}

//Funcion para imprimir los sueldos


public void Imprimir()
{
for (int i = 0; i < arreglo.Length; i++)
{
Console.WriteLine("El sueldo numero " + (i + 1) + " es: " + arreglo[i]);
}
Console.ReadKey();
Console.WriteLine("");
}
INSTITUTO TECNOLOGICO DE TIJUANA. DEPARTAMENTO DE SISTEMAS Y COMPUTACIÓN
SEMESTRE: SEPTIEMBRE – ENERO 20/21. ESTRUCTURA DE DATOS SERIE 6SC3A

static void Main(string[] args)


{
//Programa que utiliza el Metodo 1 de intercalacion simple
//Mauricio Chavez Arroyo 18212159
//Nombre del programa
Console.Title = ("U5P5. Metodo 1 intercalación simple");

Program Metodo = new Program();

Console.WriteLine("Metodo 1 de intercalacion simple");


Metodo.Capturar();
Metodo.Imprimir();

Metodo.Intercalacionsimple();
Console.WriteLine("El sueldo ordenado por el metodo de intercalacion simple
es:");
Console.WriteLine();
Metodo.Imprimir();

}
}
}
INSTITUTO TECNOLOGICO DE TIJUANA. DEPARTAMENTO DE SISTEMAS Y COMPUTACIÓN
SEMESTRE: SEPTIEMBRE – ENERO 20/21. ESTRUCTURA DE DATOS SERIE 6SC3A

VENTANA DE CAPTURA:

VENTANA DE RESULTADOS:
INSTITUTO TECNOLOGICO DE TIJUANA. DEPARTAMENTO DE SISTEMAS Y COMPUTACIÓN
SEMESTRE: SEPTIEMBRE – ENERO 20/21. ESTRUCTURA DE DATOS SERIE 6SC3A
INSTITUTO TECNOLOGICO DE TIJUANA. DEPARTAMENTO DE SISTEMAS Y COMPUTACIÓN
SEMESTRE: SEPTIEMBRE – ENERO 20/21. ESTRUCTURA DE DATOS SERIE 6SC3A

EXPLICA BREVEMENTE QUÉ TE PARECIÓ EL PROBLEMA, QUE SE TE DIFICULTO Y COMO LO


SOLUCIONASTE.
Fue un programa sencillo ya que solo fue cuestión de adaptar el pseudocódigo al
programa y con la explicación que hubo fue aún más sencillo entenderlo.

También podría gustarte