Browse Source

Updated sorting.py

luislopez66 2 years ago
parent
commit
34f423a384
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      sorting.py

+ 3
- 3
sorting.py View File

35
 	n = len(lista)
35
 	n = len(lista)
36
 	h1 = (n // 2) - 1
36
 	h1 = (n // 2) - 1
37
 	for i in range(h1, -1, -1):
37
 	for i in range(h1, -1, -1):
38
-		heapify(lista, n, i)
38
+		heapify(lista[i])
39
 
39
 
40
-	for i in range(h1, -1, -1):
40
+	for i in range(n-1, -1, -1):
41
 		lista[i], lista[0] = lista[0], lista[i]
41
 		lista[i], lista[0] = lista[0], lista[i]
42
-		heapify(lista, i, 0)
42
+		heapify(lista[i])
43
 
43
 
44
 	return lista
44
 	return lista
45
 
45