Skip to content
Activities · Activity 4.3

Q.In a deque, if insertion and deletion of elements is done from the same end, it will behave as

​1) Queue
​2) Stack
​3) List
​4) None of the above
Puducherry TnboardTextbookSubjective· 1mImportance★★★★★
21% · 3/14 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

When elements are inserted and deleted from the same end of a deque, it operates like a Stack, adhering to the Last-In, First-Out (LIFO) principle.

To understand how a deque behaves under the given condition, let's first clarify what a deque, a stack, and a queue are.

A Deque (Double-Ended Queue) is a linear data structure that allows elements to be added or removed from either the front or the rear end. It offers more flexibility than a traditional queue or stack because it supports operations at both ends.

A Stack is a linear data structure that follows the Last-In, First-Out (LIFO) principle. This means the last element added to the stack is the first one to be removed.

  • Insertion (Push): Elements are added to one end, typically called the "top" of the stack.
  • Deletion (Pop): Elements are removed from the same end (the "top") where they were inserted.

A Queue is a linear data structure that follows the First-In, First-Out (FIFO) principle. This means the first element added to the queue is the first one to be removed.

  • Insertion (Enqueue): Elements are added to one end, typically called the "rear" of the queue.
  • Deletion (Dequeue): Elements are removed from the opposite end, typically called the "front" of the queue.

Now, let's consider the condition given in the question: "insertion and deletion of elements is done from the same end" in a deque.

Imagine you insert elements A, then B, then C into one end of the deque.

The order of elements, from the insertion end, would be C, B, A.

If you then delete an element from this same end, the element C (which was the last one inserted) will be the first one to be removed. After C is removed, B will be the next to be removed, and so on.

This behavior—where the last element inserted is the first one to be deleted—is precisely the definition of the Last-In, First-Out (LIFO) principle, which is characteristic of a Stack. …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.