Skip to content

Commit efaab21

Browse files
committed
fix: Increase the process; 🚀
1 parent 070559a commit efaab21

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

package/Sort/MergeSort.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public function mSort(&$arr, $left, $right)
6060
*/
6161
public function mergeArray(&$arr, $left, $center, $right)
6262
{
63+
echo '| '.$left.' - '.$center.' - '.$right.' - '.implode(',',$arr).PHP_EOL;
6364
//设置两个起始位置标记
6465
$a_i = $left;
6566
$b_i = $center + 1;
@@ -92,4 +93,29 @@ public function mergeArray(&$arr, $left, $center, $right)
9293
//do some test:
9394
new mergeSort([4, 7, 6, 3, 9, 5, 8]);
9495

96+
/*
9597
98+
| 0 - 0 - 1 - 4,7,6,3,9,5,8
99+
| 2 - 2 - 3 - 4,7,6,3,9,5,8
100+
| 0 - 1 - 3 - 4,7,3,6,9,5,8
101+
| 4 - 4 - 5 - 3,4,6,7,9,5,8
102+
| 4 - 5 - 6 - 3,4,6,7,5,9,8
103+
| 0 - 3 - 6 - 3,4,6,7,5,8,9
104+
105+
array(7) {
106+
[0] =>
107+
int(3)
108+
[1] =>
109+
int(4)
110+
[2] =>
111+
int(5)
112+
[3] =>
113+
int(6)
114+
[4] =>
115+
int(7)
116+
[5] =>
117+
int(8)
118+
[6] =>
119+
int(9)
120+
}
121+
*/

0 commit comments

Comments
 (0)