Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 1

General case Other cases :

Divide the instance in ascending and descending groups :


6, 5, 4, 10, 9, 1, 2, 3, 7, 8
6, 5, 4, 1, 2, 3, 10, 9, 7, 8
Find the descending group with the smallest end value :
Or

1, 2, 3, 6, 5, 4, 10, 9, 7, 8
6, 5, 4, 1, 2, 3, 10, 9, 7, 8
Find the value that follows the smallest end value and apply a reversal in consequence : Or

6, 5, 4, 1, 2, 3, 10, 9, 7, 8 1, 2, 3, 10, 9, 6, 5, 4, 7, 8

Special case : descending group with end value = 1


Now that the descending group with the smallest end value finishes by 1, we must find 7 instead, and apply the reversal

6, 5, 4, 3, 2, 1, 10, 9, 7, 8 7, 8, 10, 9, 6, 5, 4, 3, 2, 1

You might also like