Results 1 to 2 of 2
Like Tree1Likes
  • 1 Post By JosAH

Thread: How to write the time complexity about n!

  1. #1
    hjxlpp is offline Member
    Join Date
    May 2013
    Posts
    17
    Rep Power
    0

    Lightbulb How to write the time complexity about n!

    Hi, everyone. Anyone can help me about this exercise? How to write a class called NFactorial with a method with the signature
    Java Code:
    public void run (int n)
    which takes running time in proportion to n!

    Thanks!

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,247
    Blog Entries
    7
    Rep Power
    24

    Default Re: How to write the time complexity about n!

    It all depends on what that method does; if it computes n! then it only does n multiplications (plus some minor stuff), so the big-Oh would be O(n); if, on the other hand, it runs a loop n! times, the big-Oh would be O(n!) ...

    kind regards,

    Jos
    jancy likes this.
    The only person who got everything done by Friday was Robinson Crusoe.

Similar Threads

  1. time complexity of toArray
    By marcosol in forum New To Java
    Replies: 13
    Last Post: 09-19-2012, 06:51 PM
  2. Time complexity question
    By romavolman in forum Advanced Java
    Replies: 8
    Last Post: 09-19-2012, 06:41 PM
  3. I need help with Time Complexity???
    By lulzim in forum Advanced Java
    Replies: 2
    Last Post: 09-20-2011, 09:11 AM
  4. I need help for Time Complexity of this???
    By lulzim in forum Advanced Java
    Replies: 9
    Last Post: 09-16-2011, 03:51 PM
  5. time complexity questions
    By myst in forum New To Java
    Replies: 6
    Last Post: 07-13-2010, 11:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •