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

## Presentation on theme: "Internet Engineering Czesław Smutnicki Discrete Mathematics – Combinatorics."— Presentation transcript:

Internet Engineering Czesław Smutnicki Discrete Mathematics – Combinatorics

CONTENT S Functions and distributions Combinatorial objects K-subsets Subsets Sequences Set partitions Number partitions Stirling numbers Bell numbers Permutations Set on/off rule

FUNCTIONS AND DISTRIBUTIONS XY X elements, Y boxes 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

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

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

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

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

SECOND TYPE STIRLING NUMBERS

BELL NUMBERS nBnBn 01 11 22 35 415 552 6203 7877 84140

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

complexity variance mean receipt number of inversion in  -1 o  n minus the number of cycles in  -1 o  n minus the lenght of the maximal increasing subsequence in  -1 o  measure D A ( ,  ) D S ( ,  ) D I ( ,  ) Move type API NPI INS PERMUTATIONS. DISTANCE MEASURES

GENERATING PERMUTATIONS. IN ANTYLEX ICOGRAPHICAL 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 { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3217021/slides/slide_12.jpg", "name": "GENERATING PERMUTATIONS.", "description": "IN ANTYLEX ICOGRAPHICAL 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

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 { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3217021/slides/slide_13.jpg", "name": "GENERATING PERMUTATIONS.", "description": "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

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 { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/11/3217021/slides/slide_14.jpg", "name": "GENERATING PERMUTATIONS.", "description": "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

Thank you for your attention DISCRETE MATHEMATICS Czesław Smutnicki