The Big-O-Notation example?

This is a discussion on The Big-O-Notation example? within the C++ Programming forums, part of the General Programming Boards category; Hi, I've just learnt about the Big-O-Notation and a bit confused about the O(2^n) one. Someone could help me out ...

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    1

    Question The Big-O-Notation example?

    Hi,
    I've just learnt about the Big-O-Notation and a bit confused about the O(2^n) one. Someone could help me out with some code example?

    Thanks

  2. #2
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    Well, if you just learned about this why don't you show us what you have tried?
    "A government big enough to give you everything you want, is big enough to take away everything you have." - Thomas Jefferson
    MSVS 2008 Pro / DevPartner / CB NightlyBuilds / MinGW / Cygwin

  3. #3
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    5,636
    it has nothing to do with code examples... It speackes about complexity of the algorithm

    For example if you say that some sorting algorithm is O(2^n) it means you should do about
    k*2^n operations to sort the array of n values, where k is a constant
    If I have eight hours for cutting wood, I spend six sharpening my axe.

  4. #4
    Registered User Bajanine's Avatar
    Join Date
    Dec 2001
    Location
    The most peaks over 10,000 feet!
    Posts
    396
    I thought the OP was asking for code:
    Someone could help me out with some code example?
    "A government big enough to give you everything you want, is big enough to take away everything you have." - Thomas Jefferson
    MSVS 2008 Pro / DevPartner / CB NightlyBuilds / MinGW / Cygwin

  5. #5
    Registered User
    Join Date
    Feb 2006
    Posts
    312
    This link to Prelude's website may be helpful in understanding Big-O notation and why its used, give it a read. http://www.eternallyconfuzzled.com/a..._art_bigo.aspx

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. big O notation question
    By l2u in forum C++ Programming
    Replies: 7
    Last Post: 11-08-2008, 02:53 PM
  2. about big O notation
    By deepakkrmehta in forum C Programming
    Replies: 3
    Last Post: 08-27-2005, 02:31 PM
  3. Big Oh notation, help me notate this
    By Jeremy G in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 05-12-2005, 03:27 PM
  4. big o notation
    By heat511 in forum C++ Programming
    Replies: 5
    Last Post: 04-19-2002, 11:27 AM
  5. Big O Notation
    By Drew in forum C++ Programming
    Replies: 1
    Last Post: 09-30-2001, 01:22 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21