Browse Source

Add new comments

Carla Ramos 2 years ago
parent
commit
60c0cfb1a0
1 changed files with 5 additions and 0 deletions
  1. 5
    0
      sorting.py

+ 5
- 0
sorting.py View File

13
 
13
 
14
 def mergeSort(lista):
14
 def mergeSort(lista):
15
 	#definan el algoritmo de ordenamiento mergesort
15
 	#definan el algoritmo de ordenamiento mergesort
16
+	# Carla Ramos Bezares
17
+	# Para realizar este código leí las explicaciones e implementaciones que ofrecen
18
+	# GeeksforGeeks y Progamiz
16
 
19
 
17
 	# check if the array has more than one element
20
 	# check if the array has more than one element
18
     if len(lista) > 1:
21
     if len(lista) > 1:
27
 
30
 
28
         i = j = k = 0
31
         i = j = k = 0
29
 
32
 
33
+		# using our "smaller" arrays, place elements in the correct position of our array
34
+
30
         while i < len(leftHalf) and j < len(rightHalf):
35
         while i < len(leftHalf) and j < len(rightHalf):
31
             if leftHalf[i] < rightHalf[j]:
36
             if leftHalf[i] < rightHalf[j]:
32
                 lista[k] = leftHalf[i]
37
                 lista[k] = leftHalf[i]