You have nine horses (numbered from 1 through 9)
with riders that are taking part in a parade.After the coordinator makes a
request for the participants to get ready to start the parade, he notices that the horses
are lined up out of order. What is the least number of horses he will have to ask
to move so that the lineup is in numerical order? (He can ask any horse to come out
of the parade and move into any gap in the lineup, asking the others to shuffle up if
necessary. )
The order of the horses is: 9,8,2,7,3,4,6,1,5
Answer :
Number horses to ask to move: Reading from left to right, we notice that horses 2,3,4 and 5 are already in
the correct order. So, we only need to ask the other five (5) horses to move in order for them to appear in order
from 1->9