Jump to content
  • Advertisement
Sign in to follow this  
Telastyn

Review implementation approach

This topic is 2536 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a problem that has come up fairly often recently here at work and want to make sure I'm not missing anything about how to approach the problem efficiently.

I am given a file with a series of containers that are valid for a given window of time. The expected range is ~25-50 per file.
Each of those containers will contain 1-12 buckets.
Each bucket can contain ~0-6 other objects, which in turn have their own valid window of time (but don't nest). Only the 'first' valid object matters (if there are any).

I'm then given ~50-150 time windows with ~1-10 references each to 'valid' containers.

I need to find all of the distinct time windows. That is, if a container (or any of its members) become valid or invalid in the middle of the time window, I need to make 2 effective time windows. There's no great resource constraints on the process. As long as it doesn't crash a modern machine or take more than a few minutes, it's good. I'm using C#, but the language shouldn't matter much.


I can answer any questions about things being unclear, and will post my approach at end of day regardless. How would you approach this problem?

Share this post


Link to post
Share on other sites
Advertisement
... well, regardless I said I'd post my approach.

I run a foreach over each (sorted) time window, finding boundaries for containers (and the contained objects if valid at all) and push them into a set along with the start and end of the time window. Once that's done I build new time windows for each of these borderposts.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!