Stable merge sort, using a temporary array. Array A[] has the items to sort. Array B[] is a work array. grailSort is approx. 30% slower but doesn't need a scratchBuffer.
See Implementation
Stable merge sort, using a temporary array. Array A[] has the items to sort. Array B[] is a work array. grailSort is approx. 30% slower but doesn't need a scratchBuffer.