GATE Assistant

Past questions › Data Science and Artificial Intelligence › GATE 2024

GATE 2024 · DA · NAT · 1 mark · Programming, Data Structures and Algorithms › Stacks, Queues & Linked Lists

GATE 2024 Data Science and Artificial Intelligence question: The fundamental operations in a double-ended queue D are: insertFirst(e) – Insert a new…

The fundamental operations in a double-ended queue are:

insertFirst(e) – Insert a new element e at the beginning of D.

insertLast(e) – Insert a new element e at the end of D.

removeFirst() – Remove and return the first element of D.

removeLast() – Remove and return the last element of D.

In an empty double-ended queue, the following operations are performed:

insertFirst(10)
insertLast(32)
a ← removeFirst()
insertLast(28)
insertLast(17)
a ← removeFirst()
a ← removeLast()

The value of is ______.

Show answer

Official answer: 17

Practise this question with exam-style marking

Discussion

No discussion yet.

Join the discussion