Advertisement
corp0

Untitled

Nov 20th, 2021
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. private void FastClasi(int indice_inferior, int indice_superior) {
  2.  
  3.   |int i = indice_inferior;
  4. 1 |int j = indice_superior;
  5.   |int pivote = arreglo_temp[indice_inferior+(indice_superior-indice_inferior)/2];
  6.  
  7.  
  8.   |while (i <= j) {
  9.   |  |while (arreglo_temp[i] < pivote) {
  10.   | 3|  4|i++;
  11.   |  |}
  12.   |
  13.   |  5|while (arreglo_temp[j] > pivote) {
  14.   |     6|j--;
  15.   | }
  16. 2 |
  17.   | 7|if (i <= j) {
  18.   |     8|intercambiarNumeros(i, j);
  19.   |
  20.   |     9|i++;
  21.   |      |j--;
  22.   | }
  23.   |}
  24.  
  25.  
  26.  10| if (indice_inferior < j)
  27.         11| FastClasi(indice_inferior, j);
  28.  12| if (i < indice_superior)
  29.         13|FastClasi(i, indice_superior);
  30.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement