416 views

2 Answers

2 votes
2 votes

Sushant's answer is correct, you can take a generalized way
if set A has cardinality m (here 5) and set B has cardinality n (here 3 ) , the number of onto functions are
= (nC0) nm - (nC1) .(n-1)m + (nC2) .(n-2)m - ... + (-1)n  (nCn-1) .(1)
= 35 - (3C1)∗25 + (3C2)∗1
= 150

Related questions

0 votes
0 votes
1 answer
2
rsansiya111 asked Dec 18, 2021
377 views
0 votes
0 votes
1 answer
3
Sumit Singh Chauhan asked Aug 18, 2018
3,400 views
What is time complexity of fun()?int fun(int n){ int count = 0; for (int i = n; i 0; i /= 2) for (int j = 0; j < i; j++) count += 1; return count;}(A) O(n^...