1 / 15

Internet Engineering Czesław Smutnicki Discrete Mathematics – Combinator ics

Internet Engineering Czesław Smutnicki Discrete Mathematics – Combinator ics. CONTENT S. Functions and distributions Combinatorial objects K-subsets Subsets Sequences Set partitions Number partitions Stirling numbers Bell numbers Permutations Set on/off rule.

Download Presentation

Internet Engineering Czesław Smutnicki Discrete Mathematics – Combinator ics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Internet Engineering Czesław Smutnicki Discrete Mathematics – Combinatorics

  2. CONTENTS • Functions and distributions • Combinatorial objects • K-subsets • Subsets • Sequences • Set partitions • Number partitions • Stirling numbers • Bell numbers • Permutations • Set on/off rule

  3. FUNCTIONS AND DISTRIBUTIONS X elements, Y boxes X Y Element can be packed to any box: n-length sequence Each box contains at most one element: set partition Box contains exactly one element: permutation

  4. K-SUBSETS Generate all subsets with k-elements from the set of n elements 1234 1235 1236 1245 1246 1256 1345 1346 1356 1456 2345 2346 2356 2456 3456

  5. SUBSETS 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 10 1010 11 1011 12 1100 13 1101 14 1110 15 1111

  6. SET PARTITION (1) (1)(2) (1,2) (1)(2)(3) (1,3)(2) (1)(2,3) (1,2)(3) (1,2,3)

  7. NUMBER PARTITION 7 6 1 5 2 5 1 1 4 3 4 2 1 4 1 1 1 3 3 1 3 2 1 1 3 1 1 1 1 2 2 2 1 2 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1

  8. SECOND TYPE STIRLING NUMBERS

  9. BELL NUMBERS

  10. PERMUTATIONS. INTRODUCTION • Permutation • Inverse permutation • Id permutation • Composition • Inversions • Cycles • Sign

  11. PERMUTATIONS. DISTANCE MEASURES Move type API NPI INS DI (, ) DA(, ) DS (, ) measure n minus the lenght of the maximal increasing subsequence in -1 o  n minus the numberof cycles in -1 o  number of inversion in -1 o  receipt mean variance complexity

  12. GENERATING PERMUTATIONS. IN ANTYLEXICOGRAPHICAL ORDER void swap(int& a, int& b) { int c=a; a=b; b=c; } void reverse(int m) { int i=1,j=m; while (i<j) swap(pi[i++],pi[j--]); } void antylex(int m) { int i; if (m==1) { for (i=1;i<=m;i++) cout << pi[i] << ' '; cout << endl; } else for (i=1;i<=m;i++) { antylex(m-1); if (i<m) { swap(pi[i],pi[m]); reverse(m-1); }} }

  13. GENERATING PERMUTATIONS. MINIMAL NUMBER OF TRANSPOSITIONS void swap(int& a, int& b) { int c=a; a=b; b=c; } int B(int m, int i) { return (!(m%2)&&(m>2))?(i<(m-1)?i:m-2):m-1; } void perm(int m) { int i; if (m==1) { for (i=1;i<=n;i++) cout << pi[i] << ' '; cout << endl; } else for (i=1;i<=m;i++) { perm(m-1); if (i<m) swap(pi[B(m,i)],pi[m]); } }

  14. GENERATING PERMUTATIONS. MINIMAL NUMBER OF ADJACENT SWAPS void swap(int& a, int& b) { int c=a; a=b; b=c; } void permtp(int m) { int i,j,x,k; int *c=new int[m+1],*pr=new int[m+1]; for (i=1;i<m;i++) { pi[i]=i; c[i]=1; pr[i]=1; } c[m]=0;for (j=1;j<=n;j++) cout << pi[j] << ' '; cout << endl; i=1; while (i<m) { i=1; x=0; while (c[i]==(m-i+1)) { pr[i]=!pr[i]; c[i]=1; if (pr[i]) x++; i++; } if (i<m) { k=pr[i]?c[i]+x:m-i+1-c[i]+x; swap(pi[k],pi[k+1]);c[i]++; for (j=1;j<=n;j++) cout << pi[j] << ' '; cout << endl; } } delete[] c; delete[] pr; }

  15. Thank you for your attention DISCRETE MATHEMATICS Czesław Smutnicki

More Related