{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

dm-lec19-counting - Generating Combinations[Algorithm 6.4.9...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Counting Methods & The Pigeonhole Principle Chapter 6 (6.8 Pigeonhole Principle) October 16, 2009 Generating Combinations [Algorithm 6.4.9] Input: r, n Output: all all r-combinations of {1,2,…,n} of {1,2,…,n} in increasing lexicographic order. 2 Generating Permutations In increasing lexicographic order Example What is the string follows 163542 ? [email protected] CS204 Discrete Math (Fall 2009) 3 • Generating the next largest bit string Generating the next largest bit string Input: b n-1 b n-2 … b 1 b 0 (not equal to 11…11) n 1 n 2 i = 0 while b i =1 { b 0 i = 0; i = i+1; } b i =1; Generating the next r-combination in lexicographic order Generating the next largest permutation in lexicographic order [email protected] CS204 Discrete Math (Fall 2009) 4
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon