Results 1 to 2 of 2

Math Help - Assistance needed!

  1. #1
    Newbie
    Joined
    Jan 2013
    From
    United States
    Posts
    16

    Assistance needed!

    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?
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor
    Joined
    Sep 2012
    From
    Australia
    Posts
    3,607
    Thanks
    591

    Re: Assistance needed!

    Hey rtrumpow.

    You could initialize a 1-D array that is the size of the set B and iterate through all elements in A and increment array[f(x)] by 1 where x is an element of A.

    In other words

    array = new int[SizeOfSetB];
    InitializeArrayToAllZeros(array);

    for (x = 1 to SizeOfSetA)
    {
    elementOfA = SetA[x];
    array[function(elementOfA)]++;
    }

    onto = true;
    for (i = 1 to SizeOfSetB)
    {
    if (array[i] == 0)
    {
    onto = false;
    break;
    }
    }

    // onto contains status of onto.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Assistance needed on this question!
    Posted in the Trigonometry Forum
    Replies: 1
    Last Post: April 18th 2012, 08:01 AM
  2. Exponential functions - assistance needed :)
    Posted in the Algebra Forum
    Replies: 2
    Last Post: January 24th 2009, 09:35 PM
  3. Assistance is needed.
    Posted in the Math Topics Forum
    Replies: 7
    Last Post: October 8th 2008, 09:46 AM
  4. Statistic assistance needed!!!
    Posted in the Advanced Statistics Forum
    Replies: 1
    Last Post: April 22nd 2008, 05:43 PM
  5. Statistic assistance needed!!!
    Posted in the Advanced Statistics Forum
    Replies: 1
    Last Post: April 22nd 2008, 05:32 PM

Search Tags


/mathhelpforum @mathhelpforum