Jump to content

Search the Community

Showing results for tags 'all combinations'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hi all, I need to write some php code to choose all possible combinations to schedule classes based on a pre-set pattern. For example, if I want to schedule a 3-hour course in the highlighted times in the timetable attached using one 2-hour block and one 1-hour block there are 40 possible combinations. Monday from 7:30 to 9:30 is the 2-hour block plus 1-hour from either of the 8 hours from the other 4 days gives 8 possibilities. Do this 5 times and there are 40 combinations. I've researched a lot and have read that brute-force is the best method. Others say use Recursive functions/Multi Dimensional Array Combinations, yet others say use the permutations formula. Does anyone have any experience with such code? Ideally I would like the output to be as follows for 3 hrs = 1x2hr + 1x1hr (as described above) : 1 | Monday | 7:30 | 2 hours 1 | Tuesday | 9:30 | 1 hour 2 | Monday | 7:30 | 2 hours 2 | Tuesday | 10:30 | 1 hour 3 | Monday | 7:30 | 2 hours 3 | Wednesday | 7:30 | 1 hour 4 | Monday | 7:30 | 2 hours 4 | Wednesday | 8:30 | 1 hour ..... and so on ...... Any help/feedback/sample code would be greatly appreciated.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.