Skip to content

Conversation

@blastooo
Copy link

No description provided.

void merge(array, lo, mid, hi)
int i = lo, j = hi
int i = lo, j = mid + 1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is correct.

for (int j = lo; j < hi; j++)
if (array[j] <= pivot)
swap(array[i], array[j])
swap(array, i, j)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is pseudocode, your update makes this less readable. Remove this change.

swap(array, i, j)
i++
swap(array[i], array[hi])
swap(array, i, hi)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is pseudocode, your update makes this less readable. Remove this change.

Copy link
Owner

@jguamie jguamie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the swap changes you made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants