Question:

Given an input line of numbers and words, a machine rearranges them following a particular rule in each step. Using the illustrated pattern, find the position of $58$ in the \emph{fourth step for:} Input: \texttt{cb kb eb 58 49 23 38 jb nb gb 69 82}

Show Hint

In step–arrangement problems, first decode the leftmost and rightmost placements per step; then simulate only as many steps as needed to locate the target element.
Updated On: Aug 22, 2025
  • Second from the left
  • Fourth from the right
  • Third from the right
  • Seventh from the left
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

Step 1: Infer the rule from the example.
At each step, the alphabetically smallest remaining word is placed at the extreme left, and the largest remaining number is placed at the extreme right. Repeating this gives all words first (ascending), then numbers (descending). Step 2: Order words and numbers for the new input.
Words (alphabetical): $cb, eb, gb, jb, kb, nb$.
Numbers (descending): $82, 69, 58, 49, 38, 23$. Step 3: Build the steps up to Step 4. \[ \begin{aligned} \text{Step 1: }& cb\; kb\; eb\; 58\; 49\; 23\; 38\; jb\; nb\; gb\; 69\; 82
\text{Step 2: }& cb\; eb\; kb\; 58\; 49\; 23\; 38\; jb\; nb\; gb\; 69\; 82
\text{Step 3: }& cb\; eb\; gb\; kb\; 49\; 23\; 38\; jb\; nb\; 82\; 69\; 58
\text{Step 4: }& cb\; eb\; gb\; jb\; kb\; 23\; 38\; nb\; 82\; 69\; 58\; 49 \end{aligned} \] Step 4: Locate $58$ in Step 4.
In Step 4 the tail is $82, 69, 58, 49$ (left to right). Hence $58$ is third from the right. \[ \boxed{\text{Third from the right}} \]
Was this answer helpful?
0
0

Questions Asked in GATE XH- C3 exam

View More Questions