We run a report, but for one of our big clients, it is taking too long. There is a loop where it loops for a list and fetches it upstream 1by1. We're making this a bulk operation now, but some items in the list might be invalid and upstream don't tell us which. I now need to silently handle the failures and remove them from the list and send the request again. I figured the best way to do this is to split the list and try again with a recursive function.

Having looked at the 2 egg problem, I wish to do the same here. I wish to minimize the number of requests to be made. That problem seems to use some quadratic function, I'm not familiar with those things or algorithms. Any help or ideas on how to implement this?

  • $\begingroup$ It is not entirely clear to me what happens when an item is "invalid". Does this mean that item should be included in the report, but that the data received is incomplete/incorrect? I presume that processing a request takes long. Does it take long to find out whether an item is invalid, or is that time negligible? Do note that implementation details are off-topic here, although the algorithmic problem here is on topic. $\endgroup$ – Discrete lizard Aug 16 at 12:36
  • $\begingroup$ You write, "That problem seems to use some quadratic function, I'm not familiar with those." A quadratic function is a polynomial for which the power is 2 for highest power term having a non-zero coefficient. For example, F(x) = 6*x^2 + 3x + 99 describes a quadratic function. $\endgroup$ – Toothpick Anemone Aug 16 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.