|
@@ -6,20 +6,13 @@ La variable largoLista define el largo de las listas a ordenar
|
6
|
6
|
La variable veces define las veces que se va a hacer el ordenamiento
|
7
|
7
|
La variable veces define las veces que se va a hacer el ordenamiento
|
8
|
8
|
Al final se imprimen los promedios de cada algortimo
|
9
|
|
-<<<<<<< HEAD
|
10
|
9
|
'''
|
11
|
10
|
|
12
|
|
-=======
|
13
|
|
-"""
|
14
|
|
->>>>>>> sortingHeap
|
15
|
11
|
import time
|
16
|
12
|
from random import randint
|
17
|
13
|
|
18
|
14
|
import heap
|
19
|
|
-<<<<<<< HEAD
|
20
|
15
|
from merge import merge
|
21
|
|
-=======
|
22
|
|
->>>>>>> sortingHeap
|
23
|
16
|
|
24
|
17
|
# Python program for implementation of MergeSort
|
25
|
18
|
|
|
@@ -28,7 +21,6 @@ from merge import merge
|
28
|
21
|
# Second subarray is arr[m+1..r]
|
29
|
22
|
|
30
|
23
|
def mergeSort(lista, l, r):
|
31
|
|
-<<<<<<< HEAD
|
32
|
24
|
if l < r:
|
33
|
25
|
# Same as (l+r)//2, but avoids overflow for
|
34
|
26
|
# large l and h
|
|
@@ -47,10 +39,6 @@ def mergeSort(lista, l, r):
|
47
|
39
|
'''
|
48
|
40
|
|
49
|
41
|
# Python program for implementation of heap Sort (Part II)
|
50
|
|
-=======
|
51
|
|
- # definan el algoritmo de ordenamiento mergesort
|
52
|
|
- return lista
|
53
|
|
->>>>>>> sortingHeap
|
54
|
42
|
|
55
|
43
|
def heapSort(lista):
|
56
|
44
|
# Se busca el tamaño de la lista
|
|
@@ -64,7 +52,6 @@ def heapSort(lista):
|
64
|
52
|
h1 = (n // 2) - 1
|
65
|
53
|
for i in range(h1, -1, -1):
|
66
|
54
|
heap.heapify(lista, n, i)
|
67
|
|
-<<<<<<< HEAD
|
68
|
55
|
|
69
|
56
|
# Se extrae los elementos uno a uno
|
70
|
57
|
h2 = n - 1
|
|
@@ -73,14 +60,6 @@ def heapSort(lista):
|
73
|
60
|
lista[i], lista[0] = lista[0], lista[i]
|
74
|
61
|
heap.heapify(lista, 0, i)
|
75
|
62
|
|
76
|
|
-=======
|
77
|
|
-
|
78
|
|
- h2 = n - 1
|
79
|
|
- for i in range(h2, 0, -1):
|
80
|
|
- lista[i], lista[0] = lista[0], lista[i]
|
81
|
|
- heap.heapify(lista, 0, i)
|
82
|
|
-
|
83
|
|
->>>>>>> sortingHeap
|
84
|
63
|
return lista
|
85
|
64
|
|
86
|
65
|
def quickSort(lista):
|