Skip to content
/ subsets Public

Simple algorithm for generating k-subsets of an n-set

License

Notifications You must be signed in to change notification settings

blazs/subsets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

subsets

C implementation of an algorithm for generating k-subsets of an n-set in lexicographic order (with respect to indexes). There is also TeX source of an unfinished note describing the algorithm.

Usage Example

Compile with gcc subs.c -o subs.

Calling ./subs 5 3 generates all 3-subsets of {1,2,3,4,5} in lexicographic order:

blazs@blazs-laptop:~/Documents$ ./subs 5 3
1 2 3 
1 2 4 
1 2 5 
1 3 4 
1 3 5 
1 4 5 
2 3 4 
2 3 5 
2 4 5 
3 4 5 

About

Simple algorithm for generating k-subsets of an n-set

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published