An online news website relies on in-page advertisements to make money. Their article pages have multiple slots for advertisements, and each slot can be used for a full-size ad or multiple smaller ads. Advertisers specify their size and desired display count per day. A diagram of a webpage. Article text is shown alongside multiple advertising boxes on the page. The news site uses a scheduling algorithm to determine which advertisements to display in each slot at each time of day. The algorithm's goal is to maximize money earned while not exceeding the display count per day, so it tries out every possible combination and picks the best one. As the number of advertisers and articles increases, the news site realizes the scheduling algorithm is taking an unreasonable amount of time and costing them valuable server time. What is the most promising way that they can improve the run time of the algorithm

Respuesta :

Answer:

Create a dynamic-sized circularly-linked list to hold a tuple of the adverts and the count. As the program runs, the sum of the counts is used to calculate the fixed advertisement time which is saved in a variable time_slot. Then a loop statement should be used to traversal the linked list continuously until the count sum is exhausted for the day.

Explanation:

A circularly-linked list is a linked list with both ends joined together. With this data structure, the continuous traversal of the list is easier and faster. A conditional statement is used in the algorithm to check and decrement the count of each advert and when all is zero or false, the program ends.