Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smspillaz/f2049694eb847604e36cd6ffc218086f to your computer and use it in GitHub Desktop.
Save smspillaz/f2049694eb847604e36cd6ffc218086f to your computer and use it in GitHub Desktop.
void inplace_merge(int *first, int *mid, int *end) {
int *datacopy[size of data];
int *left = first;
int *right = end;
int next = 0;
int n = end - first;
while (next < n) {
if (left < mid && *left < *right) {
datacopy[next++] = *left;
} else if (right < end) {
datacopy[next++] = *right;
}
}
/* Copy datacopy to first, no idea how inplace_merge works in practice lol */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment