|
@@ -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):
|