in reply to Who Needs to Find the Permutations of a List?

I've had to write code which generates programmes of study for students (although I did it in C, not perl), and it relates to power sets, not permuations. But they're similar problems. (Power sets, if you aren't aware, are all the possible subsets of a set. So there are n! permutations of a list, but 2n power sets.)

Since I was working for a modular course, the students frequently had to take 2 out of <these 3 modules>, and 2 out of <these other 4 modules> etc, etc.

The brute force and ignorance method (and oh boy, was there ever a lot of ignorance. Unfortunately, the force wasn't quite as brute as the algorithm demanded...) was to generate the power set of the target list, merge it with the student's existing program and then delete those results which didn't meet requirements (or were more complicated than necessary).

  • Comment on Re: Who Needs to Find the Permutations of a List?