1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Discrete Math Questions

  1. Oct 28, 2007 #1
    I have two problems that I am having a little trouble with. Thanks in advance.

    1. The problem statement, all variables and given/known data
    Count the number of times the following algorithm prints "Hello", then find the "best" big-oh approximation for the number of print statements in the algorithm.

    For i=1 to n
    Print "Hello"
    For j=1 to i
    Print "Hello"

    3. The attempt at a solution

    I found that
    at n=1, hello 2 times
    at n=2, hello 3 times
    at n=3, hello 4 times
    at n=4, hello 5 times
    at n=5, hello 6 times...

    I tried to find an equation that would follow this pattern but all the ones I could think of would work for a few times then it would go off. Is there an equation or something I can plug into this to figure it out? Don't worry about the Big-oh approximation as I can do that myself. I just need to figure out the formula. Thanks

    This is the second problem.

    1. The problem statement, all variables and given/known data

    How many different functions are there from {1,2,3,4} to {1,2,3}?

    2. Relevant equations


    3. The attempt at a solution

    I'm not sure what to do in this problem or what it really is asking for. I think it might have something to do with subsets of {1,2,3} but I'm not sure. Any help is great.
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you help with the solution or looking for help too?