Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Algorithm Complexity

Algorithm Complexity

Scheduled Pinned Locked Moved The Lounge
algorithmscsharphtmlcomtools
72 Posts 30 Posters 71 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Marc Clifton

    Dang. What do you know. I found it: http://www.codeproject.com/lounge.asp?msg=2248592&ForumID=1159&searchkw=algorithm&sd=13%20Jul%202007&ed=11%20Oct%202007&stype=1&Page=2#xx2248592xx[^] I actually never realized there was a "search forum" link (I was expecting a textbox with a search button). Typed in "algorithm" and found it on the second page: Genetic Programming Marc

    Thyme In The Country
    Interacx
    My Blog

    C Offline
    C Offline
    Chris Meech
    wrote on last edited by
    #36

    Hate to display my ignorance, but just where is this

    Marc Clifton wrote:

    "search forum" link

    you refer too.

    Chris Meech I am Canadian. [heard in a local bar] Donate to help Conquer Cancer[^]

    B M 2 Replies Last reply
    0
    • B Bassam Abdul Baki

      El Corazon wrote:

      but I did run some quick numbers to see, the results were interesting.

      :laugh: ;P


      "You can lead a horse to Vista, but it won't get in stall." - Bassam Abdul-Baki Web - Blog - RSS - Math - LinkedIn - BM

      E Offline
      E Offline
      El Corazon
      wrote on last edited by
      #37

      well, the results were surprising, so I am going back to check why... if htey are right it may make somethings easier for me. a+b 0.62 sec a-b 0.62 sec a*b 0.62 sec a/b 2.00 sec sin(b) 33.98sec cos(b) 35.59sec (those should be the same, which means maybe a cpu caching issue?) tan(b) 37.59sec atan2(a,b) 27.85sec atan(a/b) 38.43 (I knew it was better to do atan2 instead of division, but I didn't expect that) sqrt(b) 2.01 sec (that is the one that blew me away)

      _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

      B 1 Reply Last reply
      0
      • E El Corazon

        well, the results were surprising, so I am going back to check why... if htey are right it may make somethings easier for me. a+b 0.62 sec a-b 0.62 sec a*b 0.62 sec a/b 2.00 sec sin(b) 33.98sec cos(b) 35.59sec (those should be the same, which means maybe a cpu caching issue?) tan(b) 37.59sec atan2(a,b) 27.85sec atan(a/b) 38.43 (I knew it was better to do atan2 instead of division, but I didn't expect that) sqrt(b) 2.01 sec (that is the one that blew me away)

        _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

        B Offline
        B Offline
        Bassam Abdul Baki
        wrote on last edited by
        #38

        There are plenty of optimized sqrt methods, I'm not sure which one's the least computation required. I would expect cos to be slightly less than sin since it starts with 1 (constant), but without knowing what they're doing, they could be slightly different. The rest are interesting. I'm surprised nobody has put all of those and the different processors in a table?


        "I know which side I want to win regardless of how many wrongs they have to commit to achieve it." - Stan Shannon Web - Blog - RSS - Math - LinkedIn - BM

        E M 2 Replies Last reply
        0
        • B Bassam Abdul Baki

          There are plenty of optimized sqrt methods, I'm not sure which one's the least computation required. I would expect cos to be slightly less than sin since it starts with 1 (constant), but without knowing what they're doing, they could be slightly different. The rest are interesting. I'm surprised nobody has put all of those and the different processors in a table?


          "I know which side I want to win regardless of how many wrongs they have to commit to achieve it." - Stan Shannon Web - Blog - RSS - Math - LinkedIn - BM

          E Offline
          E Offline
          El Corazon
          wrote on last edited by
          #39

          Bassam Abdul-Baki wrote:

          I'm surprised nobody has put all of those and the different processors in a table?

          because they change per processor, and SSE series, etc. Add in cached loops and dropped caches, etc. and you have a mish-mash that most vendors just say "profile it" and see.

          _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

          B 1 Reply Last reply
          0
          • E El Corazon

            Bassam Abdul-Baki wrote:

            I'm surprised nobody has put all of those and the different processors in a table?

            because they change per processor, and SSE series, etc. Add in cached loops and dropped caches, etc. and you have a mish-mash that most vendors just say "profile it" and see.

            _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

            B Offline
            B Offline
            Bassam Abdul Baki
            wrote on last edited by
            #40

            True, but I've seen similar statistics for using different programming languages and OS's and hardware. They just list as many different configurations as possible. Oh well, we'll modify our count slightly for the sqrt. Thanks.


            "There are II kinds of people in the world, those who understand binary and those who understand Roman numerals." - Bassam Abdul-Baki Web - Blog - RSS - Math - LinkedIn - BM

            E 1 Reply Last reply
            0
            • B Bassam Abdul Baki

              There are plenty of optimized sqrt methods, I'm not sure which one's the least computation required. I would expect cos to be slightly less than sin since it starts with 1 (constant), but without knowing what they're doing, they could be slightly different. The rest are interesting. I'm surprised nobody has put all of those and the different processors in a table?


              "I know which side I want to win regardless of how many wrongs they have to commit to achieve it." - Stan Shannon Web - Blog - RSS - Math - LinkedIn - BM

              M Offline
              M Offline
              Maximilien
              wrote on last edited by
              #41

              Bassam Abdul-Baki wrote:

              The rest are interesting. I'm surprised nobody has put all of those and the different processors in a table?

              Because it's pretty much useless for comparing algorithms. An algorithm complexity is different than an algorithm running time; I can show some O(n!) algorithms that run fast for some mid to large size dataset, but once you pass a certain size the running time just jumps and prove the complexity of said algorithm.


              Maximilien Lincourt Your Head A Splode - Strong Bad

              1 Reply Last reply
              0
              • B Bassam Abdul Baki

                Is there a known method for comparing different algorithms? What we're looking for is a way to assign weights to different operands (+,-,*,/) and functions (sin,cos,tan,cot,sqrt) and see how they compare to each other. Is anyone aware of such a method? Thanks


                "Religion is assurance in numbers." - Bassam Abdul-Baki Web - Blog - RSS - Math - LinkedIn - BM

                M Offline
                M Offline
                Manuel F Hernandez
                wrote on last edited by
                #42

                You might have had better luck if you had posted this in the Algorithms/Math board!

                1 Reply Last reply
                0
                • B Bassam Abdul Baki

                  True, but I've seen similar statistics for using different programming languages and OS's and hardware. They just list as many different configurations as possible. Oh well, we'll modify our count slightly for the sqrt. Thanks.


                  "There are II kinds of people in the world, those who understand binary and those who understand Roman numerals." - Bassam Abdul-Baki Web - Blog - RSS - Math - LinkedIn - BM

                  E Offline
                  E Offline
                  El Corazon
                  wrote on last edited by
                  #43

                  Bassam Abdul-Baki wrote:

                  True, but I've seen similar statistics for using different programming languages and OS's and hardware. They just list as many different configurations as possible. Oh well, we'll modify our count slightly for the sqrt. Thanks.

                  except that the one "extra" function that breaks the cache is more expensive than anything else. Knowing that is what the profilers are designed to help you with. Counting up the operations often leads you to think something is better than it really is. You can't divorce yourself from the architecture, only cooperate with it. When you try and put "all the options" on the table, there are too many to count.

                  _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                  B 1 Reply Last reply
                  0
                  • B Bassam Abdul Baki

                    True, but they wanted something generic. And like I told others, this was added at the last minute of a proposal and they need it yesterday as usual.


                    "It is the mark of an educated mind to be able to entertain a thought without accepting it." - Aristotle Web - Blog - RSS - Math - LinkedIn - BM

                    J Offline
                    J Offline
                    Jim Crafton
                    wrote on last edited by
                    #44

                    Well then the solution is obvious. Just make up whatever numbers you want, and come up with a heinously complex algebraic "formula" that looks powerful, but is in fact meaningless. I'm pretty sure the Fed and the Stock Market have been getting away with this for years :)

                    ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog

                    B D 2 Replies Last reply
                    0
                    • C Chris Meech

                      Hate to display my ignorance, but just where is this

                      Marc Clifton wrote:

                      "search forum" link

                      you refer too.

                      Chris Meech I am Canadian. [heard in a local bar] Donate to help Conquer Cancer[^]

                      B Offline
                      B Offline
                      Big Daddy Farang
                      wrote on last edited by
                      #45

                      I'm not positive if this is what Marc was referring to or not, but there's one near the top of the page on the right-hand side. There's a little magnifying glass and the words "Search comments" which is a link. If you click it from the Lounge, you can search the Lounge by author or subject. BDF

                      C 1 Reply Last reply
                      0
                      • C Chris Meech

                        Hate to display my ignorance, but just where is this

                        Marc Clifton wrote:

                        "search forum" link

                        you refer too.

                        Chris Meech I am Canadian. [heard in a local bar] Donate to help Conquer Cancer[^]

                        M Offline
                        M Offline
                        Marc Clifton
                        wrote on last edited by
                        #46

                        Chris Meech wrote:

                        Hate to display my ignorance, but just where is this

                        No problem, it isn't very obvious to me. You know where the "first, prev, next" links are for navigating the forum? Go up two lines and there's a magnifying glass with a link titled "search comments" to the left of the Set Options button. That should probably go into the WTF for bad UI design. Marc

                        Thyme In The Country
                        Interacx
                        My Blog

                        C 1 Reply Last reply
                        0
                        • M Marc Clifton

                          Chris Meech wrote:

                          Hate to display my ignorance, but just where is this

                          No problem, it isn't very obvious to me. You know where the "first, prev, next" links are for navigating the forum? Go up two lines and there's a magnifying glass with a link titled "search comments" to the left of the Set Options button. That should probably go into the WTF for bad UI design. Marc

                          Thyme In The Country
                          Interacx
                          My Blog

                          C Offline
                          C Offline
                          Chris Meech
                          wrote on last edited by
                          #47

                          Thank you Marc. I had never noticed that before. Even odder I guess is that when you go to advanced search, the Lounge is not listed, but yet apparently it can be searched. That's a :wtf: to me. Thanks. :)

                          Chris Meech I am Canadian. [heard in a local bar] Donate to help Conquer Cancer[^]

                          M 1 Reply Last reply
                          0
                          • B Big Daddy Farang

                            I'm not positive if this is what Marc was referring to or not, but there's one near the top of the page on the right-hand side. There's a little magnifying glass and the words "Search comments" which is a link. If you click it from the Lounge, you can search the Lounge by author or subject. BDF

                            C Offline
                            C Offline
                            Chris Meech
                            wrote on last edited by
                            #48

                            Thanks, Big Daddy. :) Say did you ever meet the 'real' Big Daddy[^]. :)

                            Chris Meech I am Canadian. [heard in a local bar] Donate to help Conquer Cancer[^]

                            B 1 Reply Last reply
                            0
                            • C Chris Meech

                              Thanks, Big Daddy. :) Say did you ever meet the 'real' Big Daddy[^]. :)

                              Chris Meech I am Canadian. [heard in a local bar] Donate to help Conquer Cancer[^]

                              B Offline
                              B Offline
                              Big Daddy Farang
                              wrote on last edited by
                              #49

                              Chris Meech wrote:

                              meet the 'real' Big Daddy

                              No, sadly, I have not. But if I'm ever in Ocala, I'll be sure to stop at his museum. Thanks for the link. BDF

                              1 Reply Last reply
                              0
                              • C Chris Meech

                                Thank you Marc. I had never noticed that before. Even odder I guess is that when you go to advanced search, the Lounge is not listed, but yet apparently it can be searched. That's a :wtf: to me. Thanks. :)

                                Chris Meech I am Canadian. [heard in a local bar] Donate to help Conquer Cancer[^]

                                M Offline
                                M Offline
                                Marc Clifton
                                wrote on last edited by
                                #50

                                Chris Meech wrote:

                                Thank you Marc.

                                You're welcome! :) Marc

                                Thyme In The Country
                                Interacx
                                My Blog

                                1 Reply Last reply
                                0
                                • J Jim Crafton

                                  Well then the solution is obvious. Just make up whatever numbers you want, and come up with a heinously complex algebraic "formula" that looks powerful, but is in fact meaningless. I'm pretty sure the Fed and the Stock Market have been getting away with this for years :)

                                  ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog

                                  B Offline
                                  B Offline
                                  Bassam Abdul Baki
                                  wrote on last edited by
                                  #51

                                  Shhhhh. The whole world knows it, but you're not supposed to say it out loud. ;)


                                  "I know which side I want to win regardless of how many wrongs they have to commit to achieve it." - Stan Shannon Web - Blog - RSS - Math - LinkedIn - BM

                                  M 1 Reply Last reply
                                  0
                                  • B Bassam Abdul Baki

                                    Sweet, thanks. Actually, the search engine has improved drastically as of late.


                                    "It is the mark of an educated mind to be able to entertain a thought without accepting it." - Aristotle Web - Blog - RSS - Math - LinkedIn - BM

                                    M Offline
                                    M Offline
                                    Marc Clifton
                                    wrote on last edited by
                                    #52

                                    Bassam Abdul-Baki wrote:

                                    Actually, the search engine has improved drastically as of late.

                                    Fun with semantics: X has improved dramatically Y's new management has drastically affected programmer performance Or, the stock market went up dramatically today vs. the stock market took a drastic turn for the worse today. Anyways, I'm not taking pot shots or trying to be holier than thou or anything like that. It's simply that I was struck by the use of the word "drastic" as a modifier to "improved" and was thinking (if you can call it that) out loud in a meandering way. Marc

                                    Thyme In The Country
                                    Interacx
                                    My Blog

                                    B 1 Reply Last reply
                                    0
                                    • E El Corazon

                                      Bassam Abdul-Baki wrote:

                                      True, but I've seen similar statistics for using different programming languages and OS's and hardware. They just list as many different configurations as possible. Oh well, we'll modify our count slightly for the sqrt. Thanks.

                                      except that the one "extra" function that breaks the cache is more expensive than anything else. Knowing that is what the profilers are designed to help you with. Counting up the operations often leads you to think something is better than it really is. You can't divorce yourself from the architecture, only cooperate with it. When you try and put "all the options" on the table, there are too many to count.

                                      _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                                      B Offline
                                      B Offline
                                      Bassam Abdul Baki
                                      wrote on last edited by
                                      #53

                                      Yeah, but at this point, we don't know the OS or the language that will be used. It's just a proof of concept.


                                      "I know which side I want to win regardless of how many wrongs they have to commit to achieve it." - Stan Shannon Web - Blog - RSS - Math - LinkedIn - BM

                                      1 Reply Last reply
                                      0
                                      • M Marc Clifton

                                        Bassam Abdul-Baki wrote:

                                        Actually, the search engine has improved drastically as of late.

                                        Fun with semantics: X has improved dramatically Y's new management has drastically affected programmer performance Or, the stock market went up dramatically today vs. the stock market took a drastic turn for the worse today. Anyways, I'm not taking pot shots or trying to be holier than thou or anything like that. It's simply that I was struck by the use of the word "drastic" as a modifier to "improved" and was thinking (if you can call it that) out loud in a meandering way. Marc

                                        Thyme In The Country
                                        Interacx
                                        My Blog

                                        B Offline
                                        B Offline
                                        Bassam Abdul Baki
                                        wrote on last edited by
                                        #54

                                        That's true. However, if you'd used the search engine before, you'd know it timed out more often than not. Thus, any improvement is a drastic improvement. Is it me or is the word meandering abused in this forum? :-D


                                        "I know which side I want to win regardless of how many wrongs they have to commit to achieve it." - Stan Shannon Web - Blog - RSS - Math - LinkedIn - BM

                                        1 Reply Last reply
                                        0
                                        • B Bassam Abdul Baki

                                          Unfortunately, this is all proof of concept. We wish to estimate which would be better to submit with a proposal.


                                          "I know which side I want to win regardless of how many wrongs they have to commit to achieve it." - Stan Shannon Web - Blog - RSS - Math - LinkedIn - BM

                                          J Offline
                                          J Offline
                                          joerg smn
                                          wrote on last edited by
                                          #55

                                          Hi, maybe there is a way in between: Count the calls to non-trivial functions like trigonometrical ones in each algorithm and then time some iterations with only one of these calls so you can get an estimate on the weight of each of those function calls. This way you might not get a result like "A has O(n^2) and B has O(3n^2)" but "A's complexity is significantly higher than B's" or "both algorithms are about equal in complexity". Maybe put some tech talk on top of it noting that real-life complexity depends on platform used etc. :-)

                                          T 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups