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