3 Commits

Author SHA1 Message Date
  camila.vazquez1 56ceebacaa Commite merge nuevo 2 years ago
  camila.vazquez1 34d9cecf56 Merge con correccion Camila 2 years ago
  camila.vazquez1 63cb0b434b correccion de indentacion 2 years ago
1 changed files with 14 additions and 15 deletions
  1. 14
    15
      sorting.py

+ 14
- 15
sorting.py View File

25
                 j = 0
25
                 j = 0
26
                 k = 0
26
                 k = 0
27
 
27
 
28
-        while i < len(L) and j < len(R):
29
-                if L[i] <= R[j]:
28
+                while i < len(L) and j < len(R):
29
+                        if L[i] <= R[j]:
30
+                                lista[k] = L[i]
31
+                                i += 1
32
+                        else:
33
+                                lista[k] = R[j]
34
+                                j += 1
35
+                        k += 1
36
+
37
+                while i < len(L):
30
                         lista[k] = L[i]
38
                         lista[k] = L[i]
31
                         i += 1
39
                         i += 1
32
-                else:
40
+                        k += 1
41
+
42
+                while j < len(R):
33
                         lista[k] = R[j]
43
                         lista[k] = R[j]
34
                         j += 1
44
                         j += 1
35
-                k += 1
36
-
37
-        while i < len(L):
38
-                lista[k] = L[i]
39
-                i += 1
40
-                k += 1
41
-
42
-        while j < len(R):
43
-                lista[k] = R[j]
44
-                j += 1
45
-                k += 1
45
+                        k += 1
46
 
46
 
47
         return lista
47
         return lista
48
-
49
 def heapSort(lista):
48
 def heapSort(lista):
50
 	#definan el algoritmo de ordenamiento heapsort
49
 	#definan el algoritmo de ordenamiento heapsort
51
 	"""
50
 	"""