A queue has configuration a, b, c, d. If you want to get the configuration d, c, b, a, you need a minimum of _______.
Asked In:
BPSC TRE 3.0
Options
-
A.
2 deletions and 3 additions
-
B.
3 deletions and 3 additions
-
C.
4 deletions and 4 additions
-
D.
More than one of the above
-
E.
None of the above
Correct Answer (Detailed Explanation is Below)
B.
3 deletions and 3 additions
Detailed Explanation
Explanations:
Steps
-
Delete a → Queue: b, c, d
-
Add a → Queue: b, c, d, a
-
Delete b → Queue: c, d, a
-
Add b → Queue: c, d, a, b
-
Delete c → Queue: d, a, b
-
Add c → Queue: d, a, b, c