Example 3: Alphabetical word arrangement
Last Updated On: Sun Sep 06 2026Given Data
- Input: mango, apple, grape, banana.
- Step I: apple, mango, grape, banana.
- Step II: apple, banana, mango, grape.
Question
What is the final output?
Answer
apple, banana, grape, mango.
Solution
- The words are being placed in alphabetical order.
- Apple and banana are already in their final positions.
- Grape comes before mango alphabetically, producing the final output.