On 03/04/2015 02:18 PM, Josh wrote:

> now say A[] was = [90, 50, 33, 72, 35]
>
> and by the end of the function B[] = [33, 50, 72, 90, 35]
>
>
> now we call swap(A,B) and A would now = [33, 35, 50, 72, 90]
>
> and somehow the 35 moves in front of the 50.

Not for me. I think there is bug in the algorithm:

    auto a = [90, 50, 33, 72, 35];
    a.mergeSort;
    assert(a == [33, 50, 72, 90, 35]);    // Incorrect ordering :(

Ali

Reply via email to