A queue has configuration a, b, c, d. If you want to get the configuration d, c, b, a, you need a minimum of _______.

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

  1. Delete a → Queue: b, c, d

  2. Add a → Queue: b, c, d, a

  3. Delete b → Queue: c, d, a

  4. Add b → Queue: c, d, a, b

  5. Delete c → Queue: d, a, b

  6. Add c → Queue: d, a, b, c

OOps! You are currently offline.