Skip to content

Latest commit

 

History

History

Bell Numbers

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Given a set of n elements, find number of ways of partitioning it.

Examples:

Input: n = 2

Output: Number of ways = 2

Explanation: Let the set be {1, 2}

        { {1}, {2} } 
        { {1, 2} }

Input: n = 3

Output: Number of ways = 5

Explanation: Let the set be {1, 2, 3}

         { {1}, {2}, {3} }
         { {1}, {2, 3} }
         { {2}, {1, 3} }
         { {3}, {1, 2} }
         { {1, 2, 3} }.