Hello;

I am posed with this question. I have researched the internet for instruction but I see the same canned answer. Can someone help me on this question? I do not know where/how to begin:

Write an algorithm that determines if a function f from the finite set A to the finite set B is an onto function.

This is what I have found:

initialize empty set C

for all x in A:

C = the union of C and {f(x)}

for all y in B:

if y is not a member of C, return NOT_ONTO

return ONTO

Is there another way to answer the question?