# Data Structure Questions and Answers-Double Ended Queue (Dequeue)

## Data Structure Questions and Answers-Double Ended Queue (Dequeue)

 Question 6 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the following can be used to delete an element from the rear end of the queue?
 A `public Object deleteRear() throws emptyDEQException { if(isEmpty()) throw new emptyDEQException("Empty"); else { Node temp = head.getNext()` B `public Object deleteRear() throws emptyDEQException { if(isEmpty()) throw new emptyDEQException("Empty"); else { Node temp = head.getNext()` C `public Object deleteRear() throws emptyDEQException { if(isEmpty()) throw new emptyDEQException("Empty"); else { Node temp = head.getNext() [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]`
What is the time complexity of deleting from the rear end of the dequeue implemented with a singly linked list?
 A O(nlogn) B O(logn) C O(n) D O(n2)
Question 7 Explanation:
Since a singly linked list is used, first you have to traverse till the end, so the complexity is O(n).

 Question 8 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
After performing these set of operations, what does the final list look contain?

`InsertFront(10); InsertFront(20); InsertRear(30); DeleteFront(); InsertRear(40); InsertRear(10); DeleteRear(); InsertRear(15); display();`
 A 10 30 10 15 B 20 30 40 15 C 20 30 40 10 D 10 30 40 15
Question 8 Explanation:
A careful tracing of the given operation yields the result.

10

20 10

20 10 30

10 30

10 30 40

10 30 40 10

10 30 40

10 30 40 15

There are 8 questions to complete.