in reply to Re^3: [OT] A measure of 'sortedness'?
in thread [OT] A measure of 'sortedness'?
The only little chance of saving anything, I think, is if you have a chunk of data at the beginning or end of the combined buffer that doesn't have to move.
That's exactly what the pre-scan is doing. "Topping and tailing" the two buffers for bits that either don't need to move, or only need to be block-moved rather than merged:
|---| ---| | ___ --- | ___--- --- | ___--- --- |__--- ---| | --- | |
Don't read too much into the ascii art, but there are obviously two chunks, the left and right ends of the left buffer, that can be either left where they are or just block-moved into place, respectively.
There are 5 other possibilities:
(Full scan required.)
(Full scan required.
(Partial scan if left in place or full if moved.)
What I was looking for was something discoverable or doable during that first scan, that abetted the next stage.
|
---|