Browse Source

fixed and ready to merge

final adjustments to shellsort algorithm
Orlando04 2 years ago
parent
commit
74e9149f67
1 changed files with 8 additions and 6 deletions
  1. 8
    6
      sorting.py

+ 8
- 6
sorting.py View File

@@ -21,20 +21,22 @@ def quickSort(lista):
21 21
 	#definan el algoritmo de ordenamiento quicksort
22 22
 	return lista
23 23
 
24
+''' 
25
+	This algorithm was taken from: https://www.programiz.com/dsa/shell-sort 
26
+	and was adapted in order to work for this assigment.
27
+'''
28
+
24 29
 def shellSort(lista):
25 30
 	#definan el algoritmo de ordenamiento shellsort
26
-	# este algoritmo fue tomado de https://www.programiz.com/dsa/shell-sort 
27
-	# y adaptado para que funcione en este programa.
28
-	 
29
-	
30
-	# determinamos el tamaño de la lista para poder buscar el numero gap. 
31
+
32
+	# determening the size of the list and calculates the gap value. 
31 33
 	n = len(lista)
32 34
 	gap = n // 2
33 35
 
34 36
 	# this algorithm will run until gap reaches 1 
35 37
 	while gap > 0:
36 38
 		for i in range(gap, n):
37
-			temp = lista[i] # storing all items from lista into temp 
39
+			temp = lista[i] # storing all items from the list into temp 
38 40
 			j = i 
39 41
 
40 42
 			# compares the number in temp with the 0th possition (start of list)