|
@@ -70,11 +70,11 @@ def heapSort(lista):
|
70
|
70
|
|
71
|
71
|
|
72
|
72
|
|
73
|
|
- print(lista)
|
|
73
|
+
|
74
|
74
|
temp = lista[i]
|
75
|
75
|
lista[i] = lista[0]
|
76
|
76
|
lista[0] = temp
|
77
|
|
- print(lista)
|
|
77
|
+
|
78
|
78
|
|
79
|
79
|
|
80
|
80
|
|
|
@@ -149,8 +149,8 @@ def quickSortRec(lista, low, high):
|
149
|
149
|
if (low < high):
|
150
|
150
|
p = partition(lista, low, high)
|
151
|
151
|
|
152
|
|
- quickSortRec(lista, low, p - 1)
|
153
|
|
- quickSortRec(lista, p + 1, high)
|
|
152
|
+ quickSortRec(lista, low, p - 1)
|
|
153
|
+ quickSortRec(lista, p + 1, high)
|
154
|
154
|
|
155
|
155
|
return lista
|
156
|
156
|
|
|
@@ -214,18 +214,26 @@ for i in range(veces):
|
214
|
214
|
mergeSort(listaMerge)
|
215
|
215
|
acumulaMerge+=time.clock()-t1
|
216
|
216
|
|
|
217
|
+
|
|
218
|
+
|
217
|
219
|
t1 = time.clock()
|
218
|
220
|
heapSort(listaHeap)
|
219
|
221
|
acumulaHeap+=time.clock()-t1
|
220
|
222
|
|
|
223
|
+
|
|
224
|
+
|
221
|
225
|
t1 = time.clock()
|
222
|
226
|
quickSort(listaQuick)
|
223
|
227
|
acumulaQuick+=time.clock()-t1
|
224
|
228
|
|
|
229
|
+
|
|
230
|
+
|
225
|
231
|
t1 = time.clock()
|
226
|
232
|
shellSort(listaShell)
|
227
|
233
|
acumulaShell+=time.clock()-t1
|
228
|
234
|
|
|
235
|
+
|
|
236
|
+
|
229
|
237
|
|
230
|
238
|
print "Promedio de tiempo de ejecucion de "+ str(veces) +" listas de largo " + str(largoLista)
|
231
|
239
|
print "MergeSort " + str(acumulaMerge/veces) + " segundos"
|