C program to find the number of onto functions and to display all of them
I have to write a C program (for my Discrete Mathematics assignment) that finds the number of onto functions from set A (|A| = m) to set B (|B|=n) and to display all those functions. I wrote the code for finding the number of onto functions.
But my problem is how to display all the functions?
If A = [1,2,3], B=[a,b,c] then the number of onto functions evaluated from the formula is
3^3 - 3(2^3) + 3 = 6.
One possible solution is f = [(1,a),(2,b),(3,c)]
But my problem is: How to display each and every solution!?
This is just a trivial example. But if m and n values are increased (provided m>=n) then the number of possible onto functions increases exponentially!!
I can't think of any method to display each and every function that exists between A and B.
So, I request the community to help me solve this problem.
Please help me!!!!
Thank you in advance.