After Hours Academic

Question 14: Fastest finger first

Saurabh is building a quizzing system for a school. Each student takes a quiz on their own machine. Once completed, the machine generates a timestamp and sends it along with the student's answers to a central server. The central server stores the answers and the timestamp. At a later point, answers for all the students are checked and the highest scoring student is declared to be the winner. In case of a tie (two or more students with the same score), the student who completed the quiz soonest wins. To determine that, Saurabh looks at the timestamp in the message.

Is Saurabh's implementation of finding the student who finished the quiz quickest correct?

Solution coming up in the next post!


Solution for faster photos:

Anthony can speed up his photo viewing app by batching the request to the server. The mobile client can generate a number of random indexes (27 might be a good starting point because that is the average number of viewed photos) and send them all at once to the server. Or the client could just tell the number of images it wants and the server could itself generate a set of random indices. The server would then send all the photos in a single message. The client would cache the images and show them to the user without incurring a network round trip latency for each new photo.

#distributed-systems #qna