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

A queue follows the FIFO (First In, First Out) principle. Starting with [a,b,c,d], delete a, b and c, leaving [d]. Then add c, b and a at the rear, producing [d,c,b,a]. Therefore, the minimum is 3 deletions and 3 additions. This question tests queue operations, FIFO behavior, deletion (dequeue), insertion (enqueue), and reversal of a queue.