In the first step, the smallest number comes to the leftmost position and the remaining line shift rightward. In the next step the word that comes last in the alphabetical order occupies the second position from the left and the remaining line sift rightward. This goes alternately till all the number are ranged in ascending order and all the words in reverse alphabetical order at alternate positions.
Input : 89 bind 32 goal house 61 12 joy
Step I : 12 89 bind 32 goal house 61 joy
Step II : 12 joy 89 bind 32 goal house 61
Step III : 12 joy 32 89 bind goal house 61
Step IV : 12 joy 32 house 89 bind goal 61
Step V : 12 joy 32 house 61 89 bind goal
Step VI : 12 joy 32 house 61 goal 89 bind
In the first step, the smallest number comes to the leftmost position and the remaining line shift rightward. In the next step the word that comes last in the alphabetical order occupies the second position from the left and the remaining line sift rightward. This goes alternately till all the number are ranged in ascending order and all the words in reverse alphabetical order at alternate positions.
Step II : 15 yes 62 51 48 talk now gone
Step III : 15 yes 48 62 51 talk now gone
Step IV : 15 yes 48 talk 62 51 now gone
Step V : 15 yes 48 talk 51 62 now gone
Step VI : 15 yes 48 talk 51 now 62 gone
In the first step, the smallest number comes to the leftmost position and the remaining line shift rightward. In the next step the word that comes last in the alphabetical order occupies the second position from the left and the remaining line sift rightward. This goes alternately till all the number are ranged in ascending order and all the words in reverse alphabetical order at alternate positions.
Step III : 21 victory 30 joint 64 47 all gone
Step IV : 21 victory 30 joint 47 64 all gone
Step V : 21 victory 30 joint 47 gone 64 all
5 - 3 = 2 more steps will required.
In the first step, the smallest number comes to the leftmost position and the remaining line shift rightward. In the next step the word that comes last in the alphabetical order occupies the second position from the left and the remaining line sift rightward. This goes alternately till all the number are ranged in ascending order and all the words in reverse alphabetical order at alternate positions.
Input : win 92 task 73 59 house range 34
Step I : 34 win 92 task 73 59 house range
Step II : 34 win 59 92 task 73 house range
Step III : 34 win 59 task 92 73 house range
Step IV : 34 win 59 task 73 92 house range
In the first step, the smallest number comes to the leftmost position and the remaining line shift rightward. In the next step the word that comes last in the alphabetical order occupies the second position from the left and the remaining line sift rightward. This goes alternately till all the number are ranged in ascending order and all the words in reverse alphabetical order at alternate positions.
Input : save 21 43 78 them early 36 for
Step I : 21 save 21 43 78 them early 36 for
Step II : 21 them save 43 78 early 36 for
Step III : 21 them 36 save 43 78 early for
Step IV : 21 them 36 save 43 for 78 early
Hence step III will be the last but one.
In the first step, the smallest number comes to the leftmost position and the remaining line shift rightward. In the next step the word that comes last in the alphabetical order occupies the second position from the left and the remaining line sift rightward. This goes alternately till all the number are ranged in ascending order and all the words in reverse alphabetical order at alternate positions.
Input : desire 59 63 all few 46 zone
Step I : 38 desire 59 63 all few 46 zone
Step II : 38 zone desire 59 63 all few 46
Step III : 38 zone 46 desire 59 63 all few
Step IV : 38 zone 46 few desire 59 63 all
Step III : 38 zone 46 few 59 desire all
In the first step, the largest number comes to the first position and the remaining line shift rightward. In the next step the word that comes first in the alphabetical order goes on to occupy the second position pushing the rest of the shift rightward. This goes alternately till all the number are arranged in a descending order and all the words in alphabetical at alternate positions.
Input: how was your stay 56 25 36 64
Step I: 64 how was your stay 56 25 36
Step II: 64 how 56 was your stay 25 36
Step III: 64 how 56 stay was your 25 36
Step IV: 64 how 56 stay 36 was your 25
Step V: 64 how 56 stay 36 was 25 your
Since the line gets fully arranged in step V there will be no step VI
In the first step, the largest number comes to the first position and the remaining line shift rightward. In the next step the word that comes first in the alphabetical order goes on to occupy the second position pushing the rest of the shift rightward. This goes alternately till all the number are arranged in a descending order and all the words in alphabetical at alternate positions.
Input : power fail now 52 24 75 gate 34
Step I : 75 power fail now 52 24 gate 34
Step II : 75 fail power now 52 24 gate 34
Step III : 75 fail 52 power now 24 gate 34
Step IV : 75 fail 52 gate power now 24 34
Step V : 75 fail 52 gate 34 power now 24
Step VI : 75 fail 52 gate 34 now power 24
Step VII : 75 fail 52 gate 34 now 24 power
Hence step VI will be the last but one.
In the first step, the largest number comes to the first position and the remaining line shift rightward. In the next step the word that comes first in the alphabetical order goes on to occupy the second position pushing the rest of the shift rightward. This goes alternately till all the number are arranged in a descending order and all the words in alphabetical at alternate positions.
we can't proceed backward and cannot be determined
In the first step, the largest number comes to the first position and the remaining line shift rightward. In the next step the word that comes first in the alphabetical order goes on to occupy the second position pushing the rest of the shift rightward. This goes alternately till all the number are arranged in a descending order and all the words in alphabetical at alternate positions.
Step II : 75 down 16 24 farm eager 62 sky
Step III : 75 down 62 16 24 farm eager sky
Step IV : 75 down 62 eager 16 24 farm sky
Step V : 75 down 62 eager 24 16 farm sky
Step VI : 75 down 62 eager 24 farm 16 sky
Hence 6 - 2 = 4 more steps will be required.
Copyright ©CuriousTab. All rights reserved.