Browse Source

correccion de indentacion

camila.vazquez1 2 years ago
parent
commit
63cb0b434b
1 changed files with 17 additions and 17 deletions
  1. 17
    17
      sorting.py

+ 17
- 17
sorting.py View File

@@ -1,5 +1,5 @@
1 1
 """
2
-Carlos J Corrada Bravo
2
+iiiiCarlos J Corrada Bravo
3 3
 Este programa calcula el promedio de tiempo de ejecución de cuatro algoritmos de ordenamiento
4 4
 La variable maxValor define el valor maximo de los elementos de la lista
5 5
 La variable largoLista define el largo de las listas a ordenar
@@ -10,7 +10,7 @@ from random import randint
10 10
 import time
11 11
 
12 12
 def mergeSort(lista):
13
-        #Camila Vazquez Rodriguez 
13
+        #Camila Vazquez Rodriguez
14 14
 	#definan el algoritmo de ordenamiento mergesort
15 15
         if len(lista) > 1:
16 16
                 mid = len(lista)//2
@@ -24,25 +24,25 @@ def mergeSort(lista):
24 24
                 j = 0
25 25
                 k = 0
26 26
 
27
-        while i < len(L) and j < len(R):
28
-                if L[i] <= R[j]:
27
+                while i < len(L) and j < len(R):
28
+                        if L[i] <= R[j]:
29
+                                lista[k] = L[i]
30
+                                i += 1
31
+                        else:
32
+                                lista[k] = R[j]
33
+                                j += 1
34
+                        k += 1
35
+
36
+                while i < len(L):
29 37
                         lista[k] = L[i]
30 38
                         i += 1
31
-                else:
39
+                        k += 1
40
+
41
+                while j < len(R):
32 42
                         lista[k] = R[j]
33 43
                         j += 1
34
-                k += 1
35
- 
36
-        while i < len(L):
37
-                lista[k] = L[i]
38
-                i += 1
39
-                k += 1
40
- 
41
-        while j < len(R):
42
-                lista[k] = R[j]
43
-                j += 1
44
-                k += 1
45
-                
44
+                        k += 1
45
+
46 46
         return lista
47 47
 
48 48
 def heapSort(lista):