There's an array of values from 1 to n. It isn't sorted. We have to sort it, but there are only to ways to move: third element to beginning or last element to beginning. How to do that ?
Name:
Anonymous2010-10-24 9:37
>>13
Yeah ? So add one more:
2 1 3 4
First three elements aren't sorted, so we try to do that:
3 2 1 4
1 3 2 4
2 1 3 4
And we're in home one more time.