@@ -68,10 +68,10 @@ def merge(left, right):
68
68
return collection
69
69
70
70
two_paired_list = []
71
- is_surplus = False
71
+ has_last_odd_item = False
72
72
for i in range (0 , len (collection ), 2 ):
73
73
if i == len (collection ) - 1 :
74
- is_surplus = True
74
+ has_last_odd_item = True
75
75
else :
76
76
if collection [i ] < collection [i + 1 ]:
77
77
two_paired_list .append ([collection [i ], collection [i + 1 ]])
@@ -81,16 +81,16 @@ def merge(left, right):
81
81
result = [i [0 ] for i in sorted_list_2d ]
82
82
result .append (sorted_list_2d [- 1 ][1 ])
83
83
84
- if is_surplus :
84
+ if has_last_odd_item :
85
85
pivot = collection [- 1 ]
86
86
result = binary_search_insertion (result , pivot )
87
87
88
- is_surplus_inserted_before_this_index = False
88
+ is_last_odd_item_inserted_before_this_index = False
89
89
for i in range (len (sorted_list_2d ) - 1 ):
90
90
if result [i ] == collection [- i ]:
91
- is_surplus_inserted_before_this_index = True
91
+ is_last_odd_item_inserted_before_this_index = True
92
92
pivot = sorted_list_2d [i ][1 ]
93
- if is_surplus_inserted_before_this_index :
93
+ if is_last_odd_item_inserted_before_this_index :
94
94
result = result [: i + 2 ] + binary_search_insertion (result [i + 2 :], pivot )
95
95
else :
96
96
result = result [: i + 1 ] + binary_search_insertion (result [i + 1 :], pivot )
0 commit comments