Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6819941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:21:57+00:00 2026-05-26T21:21:57+00:00

This is a classic CS problem I encountered in my work: I have a

  • 0

This is a classic CS problem I encountered in my work:
I have a list of resources I need to load. each resource has a list of constraints it needs in order to load and when loaded satisfies other constraints that other resources may need. In example: resource X has a,b,c as constraints so it can only load when a,b and c are fulfilled. when loaded, X satisfies constraints n and m which are needed by resource Y which also needs constraint p in order to load so when another resource will load and satisfy the p constraint, Y will load, and in turn satisfy other constraints.
The list of constraints needed by all resources is final, meaning that each resource may need several constraints and each constraint may be needed by several resources.
Also, one resource needs null constraints in order to load hence must be the first to load.

Ok, after this long explanation here is my question:
How can I find the best loading sequence of the resources when all I know in advance is which constraints are needed per resource but do not know (in advance) which constraints are satisfied by a resource once loaded?

hope my explanation was clear enough…
thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:21:57+00:00Added an answer on May 26, 2026 at 9:21 pm

    EDIT

    Simple Solution:

    Create a Bipartite Graph with n Vertices (resources) and m Vertices (constraints). – O(n + m)

    Hold the constraints in some lookup table data structure (i.e. a hash table).

    Draw edges between resource vertices and constraint vertices whenever a resource needs that constraint.

    Create a list L of resources, initially empty. (this is the order in which to load the resources).

    Create a set R of resources, initiallly empty. (this is the set of resources which can be added currently). – O(1)

    Add the one resource that has 0 constraints to R. – O(1)

    while R is not empty:

    {

    Get some resource r from R – O(1)

    Add r to L – O(1)

    Let S be the set of all constraints that the resource r fulfills when being loaded.

    Foreach constraint c in S lookup the constraint vertex and remove all links going to this vertex. If at the other side of the link, there are no more links (meaning that the resource vertex is now ready to be loaded), add that vertex to R. – O(|S|)

    }

    TOTAL RUNNING TIME: O(n * |S|), where |S| is the maximum number of constraints fulfilled by a single resource.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably the most classic database problem. I have an E-commerce software solution
I have this classic ASP site which has been working fine until we updated
It's a pretty classic problem. The company I work for has numerous business reports
I have this classic problem that seems impossible to solve for me. I just
I have a problem with the FormatNumber function in Classic ASP. When this overload
I have this classic ASP web application. Each user must login and their most
Very odd problem as this is working perfectly on our old Classic ASP site.
This is ASP classic, not .Net. We have to get a way to SFTP
I'm trying to solve a classic problem - I have a multi-threaded application which
This is a classic c/p problem where some threads produce data while other read

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.