Skip to main contentSkip to solution

A deque contains ‘a’,’x’,’z’,’v’ and ‘b’ (from FRONT to REAR). Elements received after deletion are ‘b’,’a’,’v’,’x’ and ‘z’. Identify the sequence of deletion operation performed on deque.

Solution

✅ Correct Option: 2

Each deletion must remove the element at the FRONT or the REAR of what is left, so we trace the removals in the order given.

DeletionDeque beforeElement removedOperation
1a x z v bb (rear)DELETIONREAR
2a x z va (front)DELETIONFRONT
3x z vv (rear)DELETIONREAR
4x zx (front)DELETIONFRONT
5zz (only element)DELETIONREAR

The sequence is REAR, FRONT, REAR, FRONT, REAR.

The last element is both front and rear, so either operation removes it. Option 2 is the only choice whose first four operations match.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question