You are on page 1of 47

SPECIAL NUMBERS

CSE 301 July 2021


Md. Tareq Mahmood
Department of CSE, BUET
STIRLING NUMBERS
Stirling Number of Second Kind

“n subset k”

Number of ways to divide


◦ different objects
◦ into non-empty subsets
Stirling Number of Second Kind
Stirling Number of Second Kind,

For example
Means
Stirling Number of Second Kind,

Proof:
For there are subsets
Each subset has a counterpart ,
where
Stirling Number of Second Kind,

So, there are ways to divide into two subsets


One of the pair is
So, non-empty division count =
Fundamental Rule of Counting
◦ If there are type of ways to do a job
◦ Each can be done in ways
◦ # ways =

◦ If there are steps to do a job


◦ Each can be done in ways
◦ # ways =
Recursion
◦ Two type of ways to handle the last object

1. Keep it seperate

2. Keep it with others


Recursion
1. Keep it seperate

Create non-empty subsets from elements


Number of ways =
Recursion
2. Keep it with others

Two steps:
Create non-empty subsets from elements
Insert the last object to one of the subsets
Number of ways =
Recursion

Total Number of ways =


Table
Application
Stirling Number of First Kind

“n cycle k”

Number of ways to divide


◦ different objects
◦ into non-empty cycles
What is a cycle?
Recap <<
Stirling Number of First Kind
Stirling Number of First Kind,
1st kind and 2nd Kind
Recursion
◦ Two type of ways to handle the last object

1. Keep it seperate

2. Keep it with others


Recursion
1. Keep it seperate

Create non-empty cycles from elements


Number of ways =
Recursion
2. Keep it with others

Two steps:
Create non-empty cycle from elements
Insert the last object to one of the cycles
Recursion
Insert the last object to one of the cycles

Number of ways to insert an item in a cycle of size =


Recursion
Insert the last object to one of the cycles
Let, each cycle be ,
We can insert last object in -
Either
Or,
Number of Total number of ways =
Or, ways


Or,
Recursion
2. Keep it with others

Two steps:
Create non-empty subsets from elements
Insert the last object to one of the cycles
Number of ways =
Recursion

Total Number of ways =


Table
EULERIAN NUMBERS
Change, Ascents and Dscents
◦ Say, an permutation of is
◦ Change is number of positions where
◦ #change =

◦ Ascents are changes where


◦ Descents are changes where
◦ #ascents + #descents = #change
◦ Here, are 2 ascents and 1 descent
Eulerian Numbers
Number of permutation of
That have ascents
Example

⟨ ⟩ 4 =11
2
Basic Properties
when numbers are in descending order

when numbers are in ascending order

not possible, there can be maximum changes


Properties
◦ If a permutation has ascents, it has descents

◦ If we reverse the permutation, all descents will become ascents


◦ Given a permutation
◦ We need to insert a number

◦ What is the maximum number of ascents we can achieve after insertion?


◦ What is the minimum number of ascents we can achieve after insertion?
Recurrence
Two possible ways
1. Create permutation with elements that has ascents and add in such way so
that #ascents stays same
2. Create permutation with elements that has ascents and add in such way so
that #ascents increments by one
Recurrence
Way 1
◦ Create permutation with elements that has ascents

◦ Add in such way so that #ascents stays same


◦ Add at the first or at place of ascents
Recurrence
Way 2
◦ Create permutation with elements that has ascents

◦ Add in such way so that #ascents increments by one


◦ Add n at the last or add in place of descents
Recurrence
Table
HARMONIC
NUMBERS
Harmonic Numbers
Bound of
𝐻𝑛 ln 𝑛
Maximum Overhang Problem
ANT(MAN) ON
THE RUBBER
BAND
https://editor.p5js.org/shonku/sketches/2fzTM9Hg
v
THE END
References
◦ How many Blocks (& how far )can you stack to maximize overhang?
https://www.youtube.com/watch?v=Ebmxq52WnZk

You might also like