1 / 10

EQUIPO 4 ALEJANDRO VAZQUEZ MUÑOZ MINERVA MATLALCUATZI CRUZ VIRIDIANA XOCHITIONTZI CUATECONZI

INSTITUTO TECNOLOGICO DE APIZACO. CATEDRATICO: MARIA GUADALUPE REYES GUTIERREZ. EQUIPO 4 ALEJANDRO VAZQUEZ MUÑOZ MINERVA MATLALCUATZI CRUZ VIRIDIANA XOCHITIONTZI CUATECONZI ERIKA ESCAREGA RODRIGUEZ. Quick Sort: ORDENACION RAPIDA *.

bayard
Download Presentation

EQUIPO 4 ALEJANDRO VAZQUEZ MUÑOZ MINERVA MATLALCUATZI CRUZ VIRIDIANA XOCHITIONTZI CUATECONZI

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. INSTITUTO TECNOLOGICO DE APIZACO CATEDRATICO: MARIA GUADALUPE REYES GUTIERREZ EQUIPO 4 ALEJANDRO VAZQUEZ MUÑOZ MINERVA MATLALCUATZI CRUZ VIRIDIANA XOCHITIONTZI CUATECONZI ERIKA ESCAREGA RODRIGUEZ

  2. Quick Sort: ORDENACION RAPIDA *

  3. Es el método de ordenamiento Quick Sort es actualmente el mas eficiente y veloz de los metodos de ordenación. Este método es una mejora sustancial del método de intercambio directo y recibe el nombre de Quick Sort por la velocidad con que ordena los elementos del (arreglo) codigo.

  4. El secreto de Quick Sort consiste en dividir la lista original en dos listasmas pequeñas. Para ello, se elige un elemento cualquiera (aunque en general se suele utilizar el que se encuentra en medio de la lista.) que se le llama pivote. la lista original en dos listas mas pequeñas.

  5. La idea central de este algoritmo consiste en lo siguiente: Se trata de ubicar el pivote en la posicion correcta del arreglo, de tal forma que todos los elementos que se centran ala izquierda sean menores o iguales a x. Y todos los elementos que se encuentran a su derecha sean mayores o iguales a x.

  6. Las implementaciones mas eficientes realizan esta tarea Una vez terminado de recorrer el vector, se tiene en la primera posición al menor elemento de todos. El proceso se repite ahora con el segundo elemento del arreglo y así para todos los elementos.

  7. PSEUDOCODIGO

  8. quickSort(int[] v, int inicio, int fin) si(inicio>=fin) regresa pivote = v[inicio] izq    = inicio+1 der    = fin cuando (izq<=der) cuando(izq<=fin   && v[izq]< pivote) izq++ cuando(der>inicio && v[der]>=pivote) der-- si(izq<der) tmp = v[izq]                 v[izq]  = v[der]                 v[der]  = tmp

  9. CODIGO JAVA publicclassMain{publicstaticvoidmain (String[] args){Scanner sc = new Scanner(System.in);inttamanio;System.out.print("Ingrese el tamanio del arreglo: ");tamanio = sc.nextInt();int arreglo[] = new int[tamanio];for(inti = 0; i < tamanio; i++){System.out.print("arreglo["+ i +"]: ");arreglo[i] = sc.nextInt();}Quicksort(arreglo, 0, tamanio - 1);System.out.print("\nArreglo ordenado: ");for(int i = 0; i < tamanio; i++)System.out.print(arreglo[i] + " ");}

  10. GRACIAS POR SU ATENCION

More Related