Thread: need complexity pleaseee!!!

  1. #16
    Technical Lead QuantumPete's Avatar
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    894
    Quote Originally Posted by Govalant View Post
    The complexity of the 3n + 1 algorithm is not O(3n + 1)
    Well, no, it's O(n), I was trying to make a mathematical point, not a complexity one...

    QuantumPete
    "No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
    "Have you tried turning it off and on again?" - The IT Crowd

  2. #17
    Registered User
    Join Date
    May 2007
    Posts
    58
    Quote Originally Posted by QuantumPete View Post
    Well, no, it's O(n), I was trying to make a mathematical point, not a complexity one...

    QuantumPete
    It's not O(n) either, you can't know how the algorithm will behave, for now, all i know is that if n is a power of 2, the complexity will be O(log2(n))

    I'm coding something right now to analyze it.

    EDIT: here, look at the complexity plot of the 3n+1 problem

    http://img258.imageshack.us/img258/5613/plotpv7.jpg


    The average iteration number from 1 to 256 is 44.98046875.
    Last edited by Govalant; 09-10-2007 at 08:24 AM.

  3. #18

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Complexity
    By mMarko in forum C Programming
    Replies: 7
    Last Post: 01-07-2009, 04:51 AM
  2. Algorithm Complexity
    By logicwonder in forum C Programming
    Replies: 4
    Last Post: 01-09-2006, 06:03 AM
  3. Worst-case complexity of this function?
    By Ariod in forum C Programming
    Replies: 3
    Last Post: 08-17-2005, 02:17 PM
  4. question on time complexity
    By blue_gene in forum C++ Programming
    Replies: 10
    Last Post: 05-16-2004, 05:09 AM
  5. Algorithm - Complexity.
    By visitant... in forum C Programming
    Replies: 5
    Last Post: 05-13-2003, 02:24 AM