wiz-icon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

Tips about number of steps:
1. If there are n words/digits in the input then at most n1 steps are required to arrange it completely.
2. Number of words/digits arranged until the present step is greater than or equal to the present step number.
3. The pattern is 'number-descending-from-left and letters-ascending-from-right-alternately-pattern'.
Following the above pattern, how many steps will be required to complete the arrangement for the below given input?
goat out 34 59 set 75 peon 28

Open in App
Solution

The rearrangement clearly happens from both directions simultaneously, but from the inside. The fact that the rearrangement is happening from the inside makes a huge difference. The numbers are arranged in ascending order from the left and the words are arranged in descending order of their appearance in the dictionary, but from the right.
Here is how you go about numbering these elements. Note that underlined elements represent those ones to the left of the L elements that you havent numbered yet. And the italicized elements represent the ones to the right of the R elements that you havent numbered yet.
First:goat–––out––3459set75peon281R1LSecond:got––out3459set75peon282R2L1R1R1LThird:goat–––out3439set75peon283R2R2L3L1R3L1R1L
Now, it is easy to answer the question based on the numbering. The answer is three steps.

flag
Suggest Corrections
thumbs-up
0
similar_icon
Similar questions
View More
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
Matrix Definition and Representation
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon