Jul 25, 2024
low
is equal to high
, it signifies a single element (sorted).low
is less than high
, proceed with the following steps.(low + high) / 2
.low
to mid
) and the right side (mid + 1
to high
).mergeSort(1, 8)
with 8 elements.mergeSort(1, 4)
, then further split down to 1,1
, 2,2
, etc.mergeSort(5, 8)
results into [2, 4, 6, 8].