@@ -17,23 +17,23 @@ def merge(arr: list[int]) -> list[int]:
17
17
[]
18
18
"""
19
19
if len (arr ) > 1 :
20
- middle_length = len (arr ) // 2 ## Finds the middle of the array
20
+ middle_length = len (arr ) // 2 # Finds the middle of the array
21
21
left_array = arr [
22
22
:middle_length
23
- ] ## Creates an array of the elements in the first half.
23
+ ] # Creates an array of the elements in the first half.
24
24
right_array = arr [
25
25
middle_length :
26
- ] ## Creates an array of the elements in the second half.
26
+ ] # Creates an array of the elements in the second half.
27
27
left_size = len (left_array )
28
28
right_size = len (right_array )
29
- merge (left_array ) ## Starts sorting the left.
30
- merge (right_array ) ## Starts sorting the right
31
- left_index = 0 ## Left Counter
32
- right_index = 0 ## Right Counter
33
- index = 0 ## Position Counter
29
+ merge (left_array ) # Starts sorting the left.
30
+ merge (right_array ) # Starts sorting the right
31
+ left_index = 0 # Left Counter
32
+ right_index = 0 # Right Counter
33
+ index = 0 # Position Counter
34
34
while (
35
35
left_index < left_size and right_index < right_size
36
- ): ## Runs until the lowers size of the left and right are sorted.
36
+ ): # Runs until the lowers size of the left and right are sorted.
37
37
if left_array [left_index ] < right_array [right_index ]:
38
38
arr [index ] = left_array [left_index ]
39
39
left_index = left_index + 1
@@ -43,13 +43,13 @@ def merge(arr: list[int]) -> list[int]:
43
43
index = index + 1
44
44
while (
45
45
left_index < left_size
46
- ): ## Adds the left over elements in the left half of the array
46
+ ): # Adds the left over elements in the left half of the array
47
47
arr [index ] = left_array [left_index ]
48
48
left_index = left_index + 1
49
49
index = index + 1
50
50
while (
51
51
right_index < right_size
52
- ): ## Adds the left over elements in the right half of the array
52
+ ): # Adds the left over elements in the right half of the array
53
53
arr [index ] = right_array [right_index ]
54
54
right_index = right_index + 1
55
55
index = index + 1
0 commit comments