Input Output Question
Question 69
VerifiedA word arrangement machine, when given an input line of words, rearranges them step by step. In each step, the word that comes first in dictionary order among the words not yet arranged is moved to the position just after the words already arranged; the other words shift one place to the right, keeping their order. The machine stops as soon as all words are in dictionary order.
Illustration:
Input: storm brings heavy rain over coast
Step I: brings storm heavy rain over coast
Step II: brings coast storm heavy rain over
Step III: brings coast heavy storm rain over
Step IV: brings coast heavy over storm rain
Step V: brings coast heavy over rain storm
(Step V is the last step.)
Input: wind carries dust across plains
Which step will be the last step for this input?
Illustration:
Input: storm brings heavy rain over coast
Step I: brings storm heavy rain over coast
Step II: brings coast storm heavy rain over
Step III: brings coast heavy storm rain over
Step IV: brings coast heavy over storm rain
Step V: brings coast heavy over rain storm
(Step V is the last step.)
Input: wind carries dust across plains
Which step will be the last step for this input?
- AII
- BIII
- CIV
- DV
- EVI
Solution
Rav Singh AI · online
Hi! I am Rav Singh AI. For Q69, what do you want?
Answer key & full solution as text
Answer: (C) IV
🔓 Full solution is free for Cetking students.