combinations : Java Glossary
home C words local find no local find frame, full screen Google search web for topic jump to footer translate with Babelfish 2008-04-02 by Roedy Green ©1996-2008 Canadian Mind Products
Go to : punctuation 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z (all)
JDisplay neededThe JDisplay Java Applet displays the large program listings on this web page. JDisplay requires Java version 1.5 or later, preferably 1.6.0_06 . If you can’t see the listings, of you if just want to learn more about JDisplay, click here for help.
combinations
If you have a set of objects and select some of them, that selection without regard to their order is called a combination. If you have n objects there are 2n (2 to the nth power) possible combinations ranging from none present to all present. If you consider all the binary numbers ranging from 0 to 2n-1, and look at the individual bits, they map the possible combinations, 1=present 0=absent. So to generate all possible 16 bit quantities just use a for loop, for ( int i=0; i < 65535; i++).
Example Sample Code Links

Example

E.g what are the possible combinations of three objects a b c:
0 000 _
1 001 c
2 010 b
3 011 bc
4 100 a
5 101 ac
6 110 ab
7 111 abc

Sample Code

Here is an implementation of the Dijkstra algorithm for permutations and also a combinations algorithm: view

CMP_homejump to top
CMP logo
feedback Please email your feedback for publication, errors, omissions, broken/redirected link reports
and suggestions to improve this page to Roedy Green : feedback email
made with CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[65.110.21.43]
Your face IP:[38.103.63.16] You need Adobe flash to see this public service ad.
You are visitor number 10,590.
You can get a fresh copy of this page from: or possibly from your local J: drive (Java virtual drive/Mindprod website mirror)
http://mindprod.com/jgloss/combination.html J:\mindprod\jgloss\combination.html