Skip to main content

All Questions

Tagged with
3 votes
3 answers
306 views

Finding the number of ways to partition {1,2, ..., N} into p1 and p2 such that sum(p1) == sum(p2)

I am trying to write a space and time efficient algorithm to calculate the number of ways to partition a set of integers {1, 2, ..., N} into two partitions such that the sums of integers in the two ...
briancaffey's user avatar
4 votes
1 answer
5k views

Compute power set of a given set in Python

Problem: Given a set (let's say of integers), return the list of all of its subsets also known as the power set. It looks to be working, but I would like feedback on the algorithm and Python ...
Stack crashed's user avatar
6 votes
2 answers
2k views

Building a set of all subsets recursively in C++

Here is my recursive implementation of a power set function in C++. One thing that concerns me is that I am iterating over the set of sets while modifying its size. The code nevertheless functions as ...
user11881's user avatar
  • 393
3 votes
1 answer
112 views

Improving Speeds of Tokenisation of large word list for distinct combinations

I'm having trouble with a current algorithm I'm writing that takes a corpa, a list of characters in sets (1 one or larger) with a frequency number attached to it. Against another list of character ...
thomascrha's user avatar
8 votes
3 answers
3k views

Generate all elements of a power set

...
CodeYogi's user avatar
  • 5,107
3 votes
1 answer
188 views

Finding the 'Minimum' AND of all the possible subsets of a set

The subset size should be greater than or equal to 2. How can I speed up this code? ...
murdocc_007's user avatar