ei, profesor ramón castro liceaga universidad latina programacion de estructuras de datos iv....
TRANSCRIPT
![Page 1: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/1.jpg)
EI, Profesor Ramón Castro Liceaga
UNIVERSIDAD LATINA
PROGRAMACION DE ESTRUCTURAS DE DATOS
IV. MÉTODOS DE ORDENAMIENTO.
![Page 2: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/2.jpg)
EI, Profesor Ramón Castro Liceaga
QUE SON ORDENAMIENTOS DE DATOS ?
SORT / ORDENACION.-
Es reagrupar un grupo de datos en una secuencia especifica de orden
(mayor -> menor o menor -> mayor)
![Page 3: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/3.jpg)
EI, Profesor Ramón Castro Liceaga
LA ORDENACION DE ELEMENTOS PUEDE SER:
• Ordenación Interna.- En memoria principal (arrays, listas).
• Ordenación Externa.- En memoria secundaria. (dispositivos de almacenamiento externo.- archivos y Bases de datos).
![Page 4: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/4.jpg)
EI, Profesor Ramón Castro Liceaga
TIPOS DE ORDENACION
Los mas usuales son:
• POR INTERCAMBIO (Compara e intercambia elementos.- Burbuja)
• POR SELECCIÓN (Selecciona el mas pequeño y lo intercambia)
• POR INSERSION (Inserta los elementos en una sublista ordenada)
• METODO SHELL (Es una insersión mejorada)
• ORDENACION RAPIDA (Quick Sort.- divide una lista en dos partes)
![Page 5: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/5.jpg)
EI, Profesor Ramón Castro Liceaga
ALGORITMO DE EJEMPLO DE UN ORDENAMIENTO
PROBLEMA:
En una Empresa el área de Recursos Humanos requiere ordenar 3 números de empleados obteniendo la siguiente salida.
![Page 6: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/6.jpg)
EI, Profesor Ramón Castro Liceaga
POR INTERCAMBIO (Burbuja o bubble sort )
El bubble sort, también conocido como ordenamiento burbuja, funciona de la siguiente manera:
• Se va comparando cada elemento del arreglo con el siguiente; si un elemento es mayor que el que le sigue, entonces se intercambian; esto producirá que en el arreglo quede como su último elemento, el más grande.
• Este proceso deberá repetirse recorriendo todo el arreglo hasta que no ocurra ningún intercambio.
• Los elementos que van quedando ordenados ya no se comparan. "Baja el más pesado".
![Page 7: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/7.jpg)
EI, Profesor Ramón Castro Liceaga
EJEMPLO: Ordenamiento por Burbuja o bubble sort
Consiste en comparar pares de elementos adyacentes e intercambiarlos entre sí hasta que estén todos ordenados. Sea un array de 6 números de empleados: {40,21,4,9,10,35}:
Primera pasada:{21,40,4,9,10,35} <-- Se cambia el 21 por el 40.{21,4,40,9,10,35} <-- Se cambia el 40 por el 4.{21,4,9,40,10,35} <-- Se cambia el 9 por el 40.{21,4,9,10,40,35} <-- Se cambia el 40 por el 10.{21,4,9,10,35,40} <-- Se cambia el 35 por el 40.
Segunda pasada:{4,21,9,10,35,40} <-- Se cambia el 21 por el 4.{4,9,21,10,35,40} <-- Se cambia el 9 por el 21.{4,9,10,21,35,40} <-- Se cambia el 21 por el 10.
Ya están ordenados, pero para comprobarlo habría que acabar esta segundacomprobación y hacer una tercera.
![Page 8: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/8.jpg)
Funciones.- Son bloques de código utilizados para dividir un programa en partes mas pequeñas
Prototipo de función.- Es la declaración de la función en el código
Variables:
Gobales.- Nivel programa
locales.- Nivel funcion
Que son las funciones ?
![Page 9: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/9.jpg)
EI, Profesor Ramón Castro Liceaga
// Definimos una función donde A=arreglo y N=tamaño
int bubblesort(int A[],int N){
int i,j,AUX;
for(i=2;i<=N;i++){ //siguiente
for(j=N;j>=i;j--){ //anterior
if(A[j-1]>A[j]){ //si i > d intercambio
AUX=A[j-1]; //guardamos en AUX
A[j-1]=A[j]; //pasamos d a i
A[j]=AUX; //copiamos AUX en d
}
}
}
return 1;
}
![Page 10: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/10.jpg)
EI, Profesor Ramón Castro Liceaga
• Practica: Hacer un programa con Arreglos que ordene por el método de la burbuja Bubblesort en forma ascendente un vector de 10 números de empleados de una empresa.
Pseudocódigo:
1.- Inicio
2.- Definir un vector de 10 números
3.- Llenar el vector con los números
4.- Mostrar la salida de los números capturados en desorden
5.- Ordenar el vector por el método bubblesort
6.- Mostrar la salida con los números ordenados del vector
Códificación :
main()
{
int A[10];
llenavector(A,10); // es uma función
printf("ORDENAMIENTO POR BURBUJA \n");
printf("Numeros a ordenar: \n");
salida(A,10); // es uma función
printf("\n\nNumeros ordenados: \n");
bubblesort(A,10); // es uma función
salida(A,10); // es uma función
getch();
}
![Page 11: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/11.jpg)
EI, Profesor Ramón Castro Liceaga
Función que llena el vector con los números
int llenavector(int A[],int N){
int c;
int x;
cout<<"Ingrese 10 numeros de empleados:"<<endl;
for(c=1;c<=N;c++){
cin>>x; // lee x numero
A[c]=x; // lo graba en el vector
}
return 1;
}
![Page 12: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/12.jpg)
EI, Profesor Ramón Castro Liceaga
Ordenar el vector por el método bubblesort
int bubblesort(int A[],int N){ int i,j,AUX; for(i=2;i<=N;i++){ for(j=N;j>=i;j--){ if(A[j-1]>A[j]){ AUX=A[j-1]; //Intercambio A[j-1]=A[j]; A[j]=AUX; } } } return 1; }
![Page 13: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/13.jpg)
EI, Profesor Ramón Castro Liceaga
Muestra la salida de los números en el arreglo.
int salida(int A[],int N){
int c;
for(c=1;c<=N;c++){
printf("%d, ",A[c]); // muestra el vector
}
return 1;
}
// Nota: este mismo procedimiento fue el que se utilizó para mostrar los datos desordenados.(solo se escribe una vez)
![Page 14: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/14.jpg)
EI, Profesor Ramón Castro Liceaga
• Practica # S01: Construir el programa con Arreglos que ordene por el método de la burbuja Bubblesort en forma ascendente un vector de 10 números de empleados de una empresa.
• Librerias:#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <conio.h>
using namespace std;
![Page 15: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/15.jpg)
EI, Profesor Ramón Castro Liceaga
TIPOS DE ORDENACION
Los mas usuales son:
• POR INTERCAMBIO (Compara e intercambia elementos)
• POR INSERSION (Inserta los elementos en una sublista ordenada)
• POR SELECCIÓN (Selecciona el mas pequeño y lo intercambia)
• METODO SHELL (Es una insersión mejorada)
• ORDENACION RAPIDA (Quick Sort.- divide una lista en dos partes)
• CUALES SON LOS CRITERIOS DE SELECCIÓN DEL MÉTODO DE ORDENAMIENTO
• ANÁLISIS COMPARATIVO DE LAS COMPLEJIDADES DE LOS DISTINTOS MÉTODOS DE ORDENAMIENTO
![Page 16: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/16.jpg)
POR INSERSION
• El insertion sort es una manera muy natural de ordenar para un ser humano, y puede usarse fácilmente para ordenar un conjunto de cartas numeradas en forma arbitraria.
Algoritmo:
• Consiste en tomar uno por uno los elementos de un arreglo y lo recorre hacia su posición con respecto a los anteriormente ordenados. Así empieza con el segundo elemento y lo ordena con respecto al primero. Luego sigue con el tercero y lo coloca en su posición ordenada con respecto a los dos anteriores, así sucesivamente hasta recorrer todas las posiciones del arreglo.
• Ejemplo:
![Page 17: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/17.jpg)
EI, Profesor Ramón Castro Liceaga
El algoritmo en pseudocódigo
algoritmo insertSort( A : lista de elementos ordenables ) para i=1 hasta longitud(A) hacer index=A[i] j=i-1 mientras j>=0 y A[j]>index hacer A[j+1] = A[j] j = j - 1 fin mientras A[j+1] = index fin parafin algoritmo
![Page 18: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/18.jpg)
EI, Profesor Ramón Castro Liceaga
Programa completo
// insert-sort.cpp
#include <stdio.h>#include <stdlib.h>
main(){ int a[]={67,8,15,44,27,12,35}; int i,aux,k; for(i=1;i<7;i++){ aux=a[i]; k=i-1; while((k<i)&&(aux<a[k])){ a[k+1]=a[k]; k=k-1;} a[k+1]=aux;} for(i=0;i<7;i++){ printf("%i\n",a[i]);}system("pause");}
![Page 19: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/19.jpg)
EI, Profesor Ramón Castro Liceaga
POR SELECCION
• Este algoritmo trabaja seleccionando el dato más pequeño a ser ordenado que aún esta en la lista, y luego haciendo un intercambio con el elemento en la siguiente posición.
ejemplo, si tenemos el array {40,21,4,9,10,35}, los pasos a seguir son:{4,21,40,9,10,35} <-- Se coloca el 4, el más pequeño, en primeraposición : se cambia el 4 por el 40.
{4,9,40,21,10,35} <-- Se coloca el 9, en segunda posición: se cambia el9 por el 21.
{4,9,10,21,40,35} <-- Se coloca el 10, en tercera posición: se cambiael 10 por el 40.
{4,9,10,21,40,35} <-- Se coloca el 21, en tercera posición: ya está colocado.
{4,9,10,21,35,40} <-- Se coloca el 35, en tercera posición: se cambiael 35 por el 40.
![Page 20: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/20.jpg)
EI, Profesor Ramón Castro Liceaga
POR SELECCION
• Otro ejemplo del selection Sort.
• Para un arreglo de :
8, 5, 2, 6, 9, 3, 1, 4,0,7
![Page 21: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/21.jpg)
Código de la función por selección.
void selectionSort(int numbers[], int array_size){ int i, j; int min, temp; for (i = 0; i < array_size-1; i++){ min = i; for (j = i+1; j < array_size; j++){ if (numbers[j] < numbers[min]){ min = j; temp = numbers[i]; numbers[i] = numbers[min]; numbers[min] = temp; } } }
![Page 22: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/22.jpg)
EI, Profesor Ramón Castro Liceaga
POR METODO SHELL (Ordenamiento por bloques de datos)
• El algoritmo realiza multiples pases a través de la lista, y en cada pasada ordena un numero igual de items. El tamaño del set de datos (también llamado distancia o intervalo) a ser ordenado va creciendo a medida que el algoritmo recorre el array hasta que finalmente el set esta compuesto por todo el array en si mismo.
• Ejemplo
![Page 23: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/23.jpg)
EI, Profesor Ramón Castro Liceaga
POR METODO SHELL
Por ejemplo, lo pasos para ordenar el array {40,21,4,9,10,35} mediante el método de Shell serían:
Salto=3:Primera pasada:{9,21,4,40,10,35} <-- se intercambian el 40 y el 9.{9,10,4,40,21,35} <-- se intercambian el 21 y el 10.
Salto=1:Primera pasada:{9,4,10,40,21,35} <-- se intercambian el 10 y el 4.{9,4,10,21,40,35} <-- se intercambian el 40 y el 21.{9,4,10,21,35,40} <-- se intercambian el 35 y el 40.
Segunda pasada:{4,9,10,21,35,40} <-- se intercambian el 4 y el 9.Con sólo 6 intercambios se ha ordenado el array, cuando por inserción se necesitaban muchos más.
![Page 24: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/24.jpg)
EI, Profesor Ramón Castro Liceaga
void shellSort(int numbers[], int array_size){int i, j, increment, temp;increment = 3;while (increment > 0){for (i=0; i < array_size; i++){j = i;temp = numbers[i];while ((j >= increment) && (numbers[j-increment] > temp)){numbers[j] = numbers[j - increment];j = j - increment;}numbers[j] = temp;}if (increment/2 != 0)increment = increment/2;else if (increment == 1)increment = 0;elseincrement = 1;}}
![Page 25: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/25.jpg)
//shelSort.cpp (continuacion)
main(){int a[10],i,n;system("cls");
printf("Ingrese el numero de elementos\t: ");scanf("%d",&n);for(i=0;i< n;i++){printf("\nElement %d\t: ",i+1);scanf("%d",&a[i]);}
printf("\nEn desorden : ");for(i=0;i< n;i++)printf("%5d",a[i]);shellsort(a,n);
printf("\nOrdenado : ");for(i=0;i< n;i++)printf("%5d",a[i]);getch();return 0;}
//shelSort.cpp#include<stdio.h>#include<conio.h>#include<cstdlib>
void shellsort(int a[],int n){ int j,i,k,m,mid; for(m = n/2;m>0;m/=2) { for(j = m;j< n;j++) { for(i=j-m;i>=0;i-=m) { if(a[i+m]>=a[i]) break; else { mid = a[i]; a[i] = a[i+m]; a[i+m] = mid; } } } }}
![Page 26: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/26.jpg)
EI, Profesor Ramón Castro Liceaga
ORDENACION RAPIDA (Quick Sort) algoritmo recursivo.
• El Quick sort es un algoritmo del estilo divide y venceras. Es bastante más rápido que el merge sort.
El algoritmo de recursión consiste en una serie de cuatro pasos:
1. Si hay menos de un elemento a ser ordenado retorna inmediatamente (termina).
2. Tomar un elemento del vector que sirve como “muestra”
3. Dividir el array en dos partes, una con los elementos mayores y una con los elementos menores al muestra.
4. Repite recursivamente el algoritmo para las dos mitades del array original hasta que queda ordenado.
![Page 27: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/27.jpg)
EI, Profesor Ramón Castro Liceaga
Quicksort en acción sobre una lista de números aleatorios. Las líneas horizontales son valores pivote
![Page 28: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/28.jpg)
EI, Profesor Ramón Castro Liceaga
•Parámetros: •Se debe llamar a la función Quicksort desde donde quiera ejecutarse•Ésta llamará a colocar pivote para encontrar el valor del mismo•Se ejecutará el algoritmo Quicksort de forma recursiva a ambos lados del pivote
int colocar(int *v, int b, int t){ int i; int pivote, valor_pivote; int temp; pivote = b; valor_pivote = v[pivote]; for (i=b+1; i<=t; i++){ if (v[i] < valor_pivote){ pivote++; temp=v[i]; v[i]=v[pivote]; v[pivote]=temp; } } temp=v[b]; v[b]=v[pivote]; v[pivote]=temp; return pivote;}
void Quicksort(int* v, int b, int t){ int pivote; if(b < t){ pivote=colocar(v, b, t); Quicksort(v, b, pivote-1); Quicksort(v, pivote+1, t); } }
![Page 29: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/29.jpg)
EI, Profesor Ramón Castro Liceaga
Eficiencia en tiempo de ejecución.
Una medida de eficiencia es:
Contar el # de comparaciones (C)
Contar el # de movimientos de elementos (M)
Estos están en función de el #(n) de elementos a ser ordenados.
![Page 30: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/30.jpg)
EI, Profesor Ramón Castro Liceaga
Algoritmos de ordenamiento:
Externos:
1.Straight merging.2.Natural merging.3.Balanced multiway merging.4.Polyphase sort.5.Distribution of initial runs.
Algoritmos de ordenamiento:
Internos:
•Inserción directa.•Inserción binaria.•Selección directa. •Burbuja.•Shake.•Intercambio directo. •Shell.•Inserción disminución incremental. •Heap.•Tournament.•Ordenamiento de árbol. •Quick sort.•Sort particionado.•Merge sort.•Radix sort.•Cálculo de dirección.
![Page 31: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/31.jpg)
EI, Profesor Ramón Castro Liceaga
Criterios de selección del método de ordenamiento
![Page 32: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/32.jpg)
EI, Profesor Ramón Castro Liceaga
Actividad adicional:
Hacer un programa en C, C++ que muestre un menú que integre los métodos de ordenamientos anteriormente vistos.
Fuentes:http://aprender.fca.unam.mx/~rcastro/algoritmos-de-ordenamiento.pdfEjemplos de algoritmos de ordenamiento y código
Ejemplos animados.http://www.sorting-algorithms.com/bubble-sort
![Page 33: EI, Profesor Ramón Castro Liceaga UNIVERSIDAD LATINA PROGRAMACION DE ESTRUCTURAS DE DATOS IV. MÉTODOS DE ORDENAMIENTO](https://reader035.vdocuments.mx/reader035/viewer/2022070304/54d4c568497959c2518b4570/html5/thumbnails/33.jpg)
EI, Profesor Ramón Castro Liceaga
GRACIAS POR TU ATENCION …