Questions tagged [combinatorics]
Combinatorics is the branch of computer science and math that focuses on the enumerable arrangements of a finite set. This includes permutations, combinations, and partitions.
41 questions
1
vote
1
answer
217
views
How do I narrow down a search space if symmetries are equivalent?
I have an algorithm that runs a search through every combination of a 5x5 grid where each cell can have 3 values, looking to see which combinations meet certain conditions. This gives 3^25 naive ...
1
vote
1
answer
87
views
Algorithm for multi-dimensional maximisation
I would like to devise an algorithm that given:
An array of dishes with macronutrient information (proteins, fats and carbohydrates, in grams), constrained to a maximum of around 200 items.
A desired ...
1
vote
4
answers
319
views
Software-design for algorithm engineering
I'm currently working on an program that solves a graph optimization problem.
I know the "standard" software-design principles like information hiding, modularization, etc. What I'm ...
1
vote
2
answers
289
views
How to model combinatorial information in RDBMS
I need to model the persistence of combinatorial information. For example, suppose that the combination of 3 attributes (A, B, and C) are used to reference a given product. Besides that, supposed that ...
-1
votes
3
answers
612
views
Birthday Paradox, Analytical and Monte Carlo solutions give two systemically slightly different results [closed]
I was doing a Monte Carlo implementation of the Birthday Paradox in Python and I wanted to check if the results where the same as in the analytical implementation of the same problem (As they should ...
2
votes
2
answers
369
views
Designing a builder as a compile-time state machine
I'm working on a text GUI library which comes with builders for UI components (Buttons, Panels, etc). I have a base class for these builders which I'd like to redesign so that meaningless component ...
2
votes
1
answer
401
views
Calendar scheduling: home field constraints
I am working on a round-robin scheduling algorithm for sports.
The goal of the algorithm is to schedule all given games across different weeks, in the given fields and given game times. These are ...
1
vote
2
answers
194
views
Determining resource exhaustion beforehand
I guess this is a problem solving question but I am out of ideas, don't really know where else I can resort for help, and I need to solve this problem.
Essentially we have a set of consumers and a ...
-1
votes
1
answer
135
views
How to calculate binomial coefficient C(n, r) modulo some prime power?
How to calculate C(n, r) modulo m, m is of the form p^a, where p is prime.
Here C(n, r) means n choose r. The range of n and r is large (of the order of 10^18) so it cannot be solved by calculating ...
1
vote
1
answer
314
views
How to build an optimal tree given items costs and edge costs?
Given:
a list of 'leaves' that each have a cost,
the cost of creating an 'edge'
The constraint that a constructed tree node can at most have two children.
We now want to find the tree with the lowest ...
4
votes
1
answer
352
views
Spreading objects in bags and bags' compartments
We have 10 bags. Each bag has 5 compartments numbered from 1 to 5. We have 100 objects to fill all the compartments and bags.
Compartment number x in a bag is identical to compartment of the same ...
0
votes
2
answers
1k
views
How do I write an algorithm to solve a set of 3 symbolic equations
Replace each symbol (letter) with a number so that the equations hold across all 3 equations. Solution should be able to solve the general case of any 3 equations. Can assume 2 terms summed to an ...
9
votes
3
answers
431
views
Picking the most calorie-even arrangement of meals
Suppose I eat five meals a day, and since there are seven days in a week, I have recipes for seven of each meal, for 35 recipes in total. Each recipe has a calorie count. Each day must contain one ...
-1
votes
1
answer
173
views
Combinations of a password
I am trying to encrypt a password for my school project. Here is the process:
Let's assume that I have a string p (n characters long) which contains the password.
The program reverses the string and ...
0
votes
1
answer
1k
views
The maximum number of induced cycle in a simple directed graph
Given a simple directed graph G=(V,E) an induced cycle is a cycle where no two vertices of the cycle have an edge that is not in the cycle.
(Chordless cycles are induced cycles with at lease 4 ...
0
votes
1
answer
184
views
Mapping match-up combinations into an integer
First of all, I want to say I wasn't sure if I should post this here or in math.stackexchange but I think the question is too programming-related to belong to the latter community. Definetly not a SO ...
0
votes
0
answers
65
views
What algorithm to use to count realization of high combinatorics setup?
I'll use the MobA games to illustrate what I'm asking since it's easier to explain even tho I want to apply that algorithm to time series.
In a MobA game you have more than 100 characters and every ...
3
votes
1
answer
6k
views
Algorithm to compute k-permutation without repeating and no duplicates
I have a set of integers, for example 1..20 and I want to get all possible combinations of that set drawing 5 numbers.
So each combination has 5 numbers from that set of integers. But I don't want ...
0
votes
0
answers
362
views
Domain analysis for discrete values - ON and OFF points in these cases
Following my previous question (with great answer from Bart van Ingen Schenau), I noticed a discrepancy I could not wrap my head around:
Bart mentioned that:
The point ON the boundary is by
...
7
votes
3
answers
9k
views
Number of strings containing a specific substring
I've seen numerous questions (and answers) concerning the number of binary strings (e.g "10010" containing some binary substring (e.g "00"). I'd like to know if there is a way to generalize this:
...
0
votes
1
answer
3k
views
How do I create every permutation [closed]
I have a list of letters, this is just an example list:
['a','b','c','d','e']
How do I compute every combination of the list? The letters cannot repeat, for example.
a,b,c,d,e
a,c,b,d,e
a,c,d,b,e
a,...