• edited by
811 views
0 0 votes
Suppose that we use a linked list to represent a queue and that in addition to the enqueue and dequeue functions add a new operation to the queue that deletes the last element of the queue. Which of the following linked structures do we need to use to guarantee that this operation is also executed in constant time?

1. Singly linked list with both front and rear pointer.

2. Singly circular linked list with front pointer only.

3. Singly circular linked list with rear pointer only.

4. Singly circular linked list with both front and rear pointer.

5. Doubly linked list with both front and rear pointer.

(a) 1,3 and 4 only

(b) 1, 3 and 5 only

(c) 1 and 2 only

(d) 3, 4 and 5 only

Please log in or register to answer this question.

Position:
Show:

Related questions

0 0 votes
1 1 answer
2.4k
2.4k views
gagan55 asked Jul 13, 2023
2,423 views
How to Visualize this code ?#include<stdio.h #include<stdlib.h struct node{ int data; struct node *next; }; void addFirst(struct node head,int val){ struct node *newNode...
1 1 vote
1 1 answer
1.3k
1.3k views
Souvik33 asked Nov 2, 2022
1,340 views
Which data structure would be most appropriate to implement a collection of values with the following 3 characteristicsSingly link list with head and tail pointerDoubly l...