Sign in
Please select an account to continue using cracku.in
↓ →
Study the following information carefully and answer the given questions.
A word and number arrangement machine when given an input line of words and numbers rearranges them following a particular rule in each step. The following is an illustration of input and rearrangement.
Input: pepsi 56 coke sprite 12 fanta 32 48 rasna 15
Step 1: coke pepsi sprite 12 fanta 32 48 rasna 15 56
Step 2: coke 12 pepsi fanta 32 48 rasna 15 sprite 56
Step 3: coke 12 fanta pepsi 32 rasna 15 48 sprite 56
Step 4: coke 12 fanta 15 pepsi 32 rasna 48 sprite 56
Step 4 is the final step of the process.
Another input is processed through the same machine.
Input: 68 fly 24 38 pig 91 star 56 eagle air
How many steps are required to get the desired output from the given input?
If we observe all the four steps given of first input, in the first step the word that comes first in the dictionary is arranged at the left most end and biggest number among the given numbers is arranged at the right most end.
In the second step the word that comes last in the dictionary is arranged in the last but one position from the right end, and the smallest number is in the second position from the left end.
And this process is repeated until words and number are arranged alternatively, such that words are in dictionary order from the left end and numbers are in ascending order
The following is the step-wise process for the given input
Input: 68 fly 24 38 pig 91 star 56 eagle air
Step 1: air 68 fly 24 38 pig star 56 eagle 91
Step 2: air 24 68 fly 38 pig 56 eagle star 91
Step 3: air 24 eagle fly 38 pig 56 68 star 91
Step 4: air 24 eagle 38 fly 56 pig 68 star 91
Step 4 is the last step.
Create a FREE account and get: