edited by
731 views
1 votes
1 votes
Which data structure can be used to implement a collection of elements with following constraints in most efficient manner?

Constraints:

Items are retrieved and removed in FIFO order.

There is no limits in number of elements

Size of an item is relatively larger than storage required for memory address

I) Doubly linked list with pointer to 1st node

II) Singly linked list with pointer to head and tail

III) Circular doubly linked list with pointer to 1st node

IV) Binary tree

a) I and II

b) IV and III

c)II and IV

d) II and III
edited by

1 Answer

1 votes
1 votes
Circular Double Linked list It can be done as follows while inserting always insert at first

x= create new node

x->next=1st;

x->prev=1st->prev;

1st->prev->next=x;

1st->prev=x;

for deletion it will be

1st>prev->prev->next=1st;

1st->prev=1st->prev->prev

With single linked list we can do insertion at rear and deletion at front

Managing Fifo order in Binary tree is near impossible

And Double Linked list with single pointer is also impossible

option D

Related questions

0 votes
0 votes
1 answer
2
kickassakash asked Jul 4, 2023
424 views
I have specific doubt on this question and I’ve tried to explain that in the picture ,If anyone can explain it then it’ll be of great help. according to sachin sir th...
0 votes
0 votes
1 answer
3
Souvik33 asked Apr 2, 2023
435 views
There are Insert and Retrieve_Max operations on a set {}. for n such operations what is the time complexity of the efficient algorithm possible?$n^{2}$nlogn n logn
0 votes
0 votes
1 answer
4
Souvik33 asked Nov 2, 2022
876 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...