The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
1answer
36 views

Any way to optimize or improve this python combinations/subsets functions?

I believe this is essentially the same method as the itertools.combinations function, but is there any way to make this code more more perfect in terms of speed, code size and readability : def ...
0
votes
1answer
36 views

Generalize subsets function for any order subset, concisest way possible? [closed]

Implementing a toy Apriori algorithm for a small-data association rule mine, I have a need for a function to return all subsets. The length of the subsets is given by parameter i. I need to ...
2
votes
2answers
81 views

multi-recursive replacement function

I wrote a function for creating all possible translations of a source string, based on a multiple translation map. It works, but generates a lot of intermediate maps (see line marked with *). Is there ...
1
vote
2answers
98 views

Discovering words from letters in Clojure (Letterpress Solver)

I created a Letterpress solver that will take a string of letters and return a list of valid words that can be constructer with the provided letters. Not all letters need to be used in each word. ...
5
votes
1answer
322 views

Pairwise Combinations Generator

Below is an algorithm to generate all pairwise combinations for a set of random variables. See here for an explanation of what constitutes a minimal all-pairs set. The algorithm below works but I feel ...
5
votes
1answer
264 views

Enumerate k-combinations in Clojure (P26 from 99 problems)

I've been playing with Clojure for the last few evenings, going through the well known 99 problems (I'm using a set adapted for Scala). Problem 26 calls for a function that, given a set S and a no. ...
9
votes
5answers
3k views

Better way to generate all combinations?

I'm generating all combinations of an array, so for instance, ["a", "b", "c", "d"] will generate: [ "a", "b", "ab", "c", "ac", "bc", "abc", "d", "ad", "bd", "abd", "cd", ...
2
votes
1answer
223 views

A combinatorial algorithm

How could I improve this algorithm? The goal is to organize matches between sport teams such that: Each team affront each other A minimum number of team should start a match after just finishing one ...
1
vote
2answers
1k views

Python generator function that yields combinations of elements in a sequence sorted by subset order

In Python, itertools.combinations yields combinations of elements in a sequence sorted by lexicographical order. In the course of solving certain math problems, I found it useful to write a function, ...