Given a scenario:
Suppose there is a web-server hosting a website to declare results. This server can handle a maximum of 100 concurrent requests to view results. So, as to serve thousands of user requests, a ________ would be the most appropriate data structure to use.
Given a scenario:
Suppose there is a web-server hosting a website to declare results. This server can handle a maximum of 100 concurrent requests to view results. So, as to serve thousands of user requests, a ________ would be the most appropriate data structure to use.
Solution
A queue works on FIFO (First In, First Out). Requests beyond the 100 the server can handle wait in the queue and are served in the order they arrived, so every user is served fairly.
Stack: it is LIFO, so the latest request would be served first and early requests could wait indefinitely.
Dictionary: it stores key-value pairs for lookup and has no notion of arrival order.
Related questions:
2025: 16 May Shift 1
2026: 18 May Shift 2
2025: 22 May Shift 1