5,499 views
0 votes
0 votes

Consider a situation where a client receives packets from a server. There may be differences in speed of the client and the server. Which data structure is best suited for synchronization?
(A) Circular Linked List
(B) Queue
(C) Stack
(D) Priority Queue

3 Answers

Best answer
5 votes
5 votes

The key word here is "synchronization". Here Synchronization means that client should receives data in same manner (i.e sequence) in which server is sending. For this purpose the best data structure is Queue

In the question they are talking about the speed of Server and Client, not medium. So data will come in the same sequence to the client in which server will send.

Hence Answer will be "B : Queue". 

selected by
2 votes
2 votes

i think word synchronization  means in  a proper order  and queue is most sutaible data structure bcz they are in FIFO manner 

but if you use stack then order of data get reverse bcz stack is in LIFO manner so wrong . and priority queue used when data are comes randomly and we want to set the order of data so it also wrong and remaining circular  link list in which we need to maintain the  two pointer and , occupying space, and it requires more processing to insert or delete an element  so QUEUE is answer 

BUT if they give circular queue in option then it will be more efficent theh normal queue

0 votes
0 votes

B: Queue is most suitable here

a. Circular Linked List can not be use here as in synchronization we need to compare specific length of bits in the same manner sent by server, so no use of Circular Linked List.

c. as stack can process bits in opposite manner as sent by server.

d. Priority Queue is not used here as no priority based operation are performed in synchronization.

Related questions

1 votes
1 votes
1 answer
1
Anil Khatri asked Oct 4, 2016
377 views
Deletion at ending1. Linked list =O(n)2. Array = O(1)3. Dynamic array =O(1)Correct?But given is O(n) for dynamic array
0 votes
0 votes
0 answers
3
Rohit Gupta 8 asked Oct 27, 2017
1,064 views
Most efficient data structure to implement Sets of Integer and what is the complexity of operationinsert(int e),delete(int e),isMember(int e) : returns TRUE if member oth...