6,205 views
0 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
4 4 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 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 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.

Position:
Show:

Related questions

1 1 vote
1 1 answer
788
788 views
Anil Khatri asked Oct 4, 2016
788 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
2 2 votes
1 1 answer
693
693 views
sh!va asked Jul 16, 2016
693 views
Shiva is designing a new software. He wants to select a data structure to store integers such that "Deletion of the smallest element" and " Insertion of an element if it ...
–1 –1 vote
0 0 answers
825
825 views
2 2 votes
1 1 answer
2.2k
2.2k views
radha gogia asked Dec 10, 2015
2,183 views
If I have n elements in the heap then why does the index of leaf nodes ranges from index ⌊n/2⌋+1 to index n ?