// If current element is the only element in the vector, return the element
if(low + 1 == high)return;
// Find the center of the current vector
unsignedint center = ((high + low) / 2);
// Sort lower half
mergeHelper(start, low, center);
// Sort upper half
mergeHelper(start, center, high);
// Combine consecutive sorted ranges [first, middle) and [middle, last)
// into a single sorted range [first, last)
inplace_merge(start + low, start + center, start + high);
}
I understand "what" the inplace merge function is supposed to do...but I'll be damned if I can figure out how to write the code for it and I have been unsuccessful in my online searches.
How would I write the code for my own inplace_merge function?
Last edited by FC Jamison; Feb 27th, 2007 at 3:23 am.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.