Questions tagged [combinatorics]

Combinatorics is a branch of mathematics concerning the study of finite or countable discrete structures.

12 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
0answers
802 views

Finding combination of coins that can produce a given sum

This function is checking, whether it has enough money in a list called self.deviceMoney to make change. It works exactly the way I want, but only in case where ...
3
votes
0answers
71 views

Determining if two packs are permutations of each other during compile-time

Often we need to find out if two tuples, or two packs in general, are the same as each other up to permutation. If there are no repeat types, then implementing ...
3
votes
0answers
300 views

Recursively generate combinations while using Boost Coroutines

I've tried out implementing a combination generator using boost coroutines. It accepts an array of possible values and generates one array at a time for each combination. As a limitation, it only ...
3
votes
0answers
2k views

Brute force shortest path in Java

I had to ask myself a couple years ago: before Edsger Dijkstra invented his famous shortest path algorithm, how brute force approach would seem. Below is my version. It's super slow, but I find it ...
3
votes
0answers
430 views

Python knapsack program

I have this data for the knapsack problem: List of product prices = MENU Most popular product count = MOST_POPULAR_COCKTAIL ...
2
votes
0answers
30 views

Interleave two lists, preserving the order of elements in their original list

I need to write an OCaml program that return all possible zip of two lists together while preserving the order of the element in each list. For example, if we zip the lists [1;2] and [3;4], we get [[1;...
2
votes
0answers
57 views

Calculate and plot expected value involving summations and products

I wrote a code to calculate a series of summations and products for a maths assignment I'm doing. The equation is shown below. $$E(\sigma)=[1-(P(\text{$1^{st}$ rejects}) \times P(\text{$2^{nd}$ ...
2
votes
0answers
3k views

Solution to King Kohima problem in Python

King Kohima problem: King Kohima has reserved a new exclusive street for his executive class employees where they can build their homes. He has assigned you to plan that street. You have to ...
1
vote
0answers
52 views

itertools.produce reduced and filtered

I need to generate list of all allowable test combination values of of actor, action and ...
1
vote
0answers
228 views

Permutation of a given set

A simple aspect of brute forcing certain problems is that you may have to do a large numbers of tasks in large numbers of possible orders, as such an algorithm for calculating all these possible ...
1
vote
0answers
481 views

Generating combinations from two joined vectors

I have the following code to generate all combinations from two joined vectors. I have some restrictions: Exclude combinations if all members have the same "d" value Exclude combinations if several ...
1
vote
0answers
420 views

Give the variable length permutations (combinations) of a set of strings

This code is a proof-of-concept which I intend to convert into a static utility / helper class. I'm looking at this review from a structure or performance viewpoint. Small detail such as whether it ...