Bloomberg New Grad 2020 | Phone Interview | Question

This was a very open ended question.

Qustion based around TCP/UDP protocols.

Assume, we have constant stream of strings and order at which they should be displayed. Messages may come out of order but has to be displayed in the correct order sent with the message
Ex:

  1. ("ACB", to be printed 1st) - recieved first, printed first
  2. ("DGB", to be printed 3rd) - recieved second, printed third
  3. ("RTP", to be printed 2nd) - recieved third, printed second
    and so on

Output should be: "ACB", "RTP", "DGB"
This is continuous stream of messages that is calling function reciever.

Discuss the time and space complexity.

Comments (7)