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. An easy programming problem?

An easy programming problem?

Scheduled Pinned Locked Moved The Lounge
csshelpquestion
14 Posts 10 Posters 0 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.
  • V Offline
    V Offline
    Vasily Tserekh
    wrote on last edited by
    #1

    It was the year 2009 when I went to the regionals of the ACM-IBM programming contest thats when I saw what i thinked the easiest problem. I give you a set of 2D points(1000 max) and the output is how many isoceles triangles can be formed with those points. Later on I realized that problem was trap it has to give the output i less than 2 seconds can you think in a solution? I did later after six hours sitting on my PC That teach me something I will never forget. No matter how great programmer you think you are there is always some problem to solve that is out of your reach

    S W R A J 7 Replies Last reply
    0
    • V Vasily Tserekh

      It was the year 2009 when I went to the regionals of the ACM-IBM programming contest thats when I saw what i thinked the easiest problem. I give you a set of 2D points(1000 max) and the output is how many isoceles triangles can be formed with those points. Later on I realized that problem was trap it has to give the output i less than 2 seconds can you think in a solution? I did later after six hours sitting on my PC That teach me something I will never forget. No matter how great programmer you think you are there is always some problem to solve that is out of your reach

      S Offline
      S Offline
      Slacker007
      wrote on last edited by
      #2

      Vasily Tserekh wrote:

      there is always some problem to solve that is out of your reach

      I think this is what keeps us moving in a forward direction.

      "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
      "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011) "But you probably have the smoothest scrotum of any grown man" - Pete O'Hanlon (2012)

      Mike HankeyM 1 Reply Last reply
      0
      • V Vasily Tserekh

        It was the year 2009 when I went to the regionals of the ACM-IBM programming contest thats when I saw what i thinked the easiest problem. I give you a set of 2D points(1000 max) and the output is how many isoceles triangles can be formed with those points. Later on I realized that problem was trap it has to give the output i less than 2 seconds can you think in a solution? I did later after six hours sitting on my PC That teach me something I will never forget. No matter how great programmer you think you are there is always some problem to solve that is out of your reach

        W Offline
        W Offline
        wizardzz
        wrote on last edited by
        #3

        That's why managers pad inexperienced programmers' time estimates. Realizing the complexity of a problem from the beginning is another skill to develop, as important as constructing algorithms. I am in no way implying you are inexperienced.

        B 1 Reply Last reply
        0
        • V Vasily Tserekh

          It was the year 2009 when I went to the regionals of the ACM-IBM programming contest thats when I saw what i thinked the easiest problem. I give you a set of 2D points(1000 max) and the output is how many isoceles triangles can be formed with those points. Later on I realized that problem was trap it has to give the output i less than 2 seconds can you think in a solution? I did later after six hours sitting on my PC That teach me something I will never forget. No matter how great programmer you think you are there is always some problem to solve that is out of your reach

          R Offline
          R Offline
          R Giskard Reventlov
          wrote on last edited by
          #4

          Vasily Tserekh wrote:

          No matter how great programmer you think you are there is always some problem to solve that is out of your reach

          Yes, my moments usually starts with 'Hello World' and VB... :-) My boss asked me yesterday if I'd ever used VB.Net. I said no, quite emphatically. That was the end of that conversation.

          "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me

          1 Reply Last reply
          0
          • V Vasily Tserekh

            It was the year 2009 when I went to the regionals of the ACM-IBM programming contest thats when I saw what i thinked the easiest problem. I give you a set of 2D points(1000 max) and the output is how many isoceles triangles can be formed with those points. Later on I realized that problem was trap it has to give the output i less than 2 seconds can you think in a solution? I did later after six hours sitting on my PC That teach me something I will never forget. No matter how great programmer you think you are there is always some problem to solve that is out of your reach

            A Offline
            A Offline
            AspDotNetDev
            wrote on last edited by
            #5

            Vasily Tserekh wrote:

            can you think in a solution?

            I'm not sure how fast it will run (and it depends on the computer), but... Pick a point. Sort the remaining points into a binary tree based on distance from the first point. If any are equal distance, that's an isosceles triangle (so, increment). Repeat, picking each of the rest of the points as the center.

            Thou mewling ill-breeding pignut!

            A 1 Reply Last reply
            0
            • V Vasily Tserekh

              It was the year 2009 when I went to the regionals of the ACM-IBM programming contest thats when I saw what i thinked the easiest problem. I give you a set of 2D points(1000 max) and the output is how many isoceles triangles can be formed with those points. Later on I realized that problem was trap it has to give the output i less than 2 seconds can you think in a solution? I did later after six hours sitting on my PC That teach me something I will never forget. No matter how great programmer you think you are there is always some problem to solve that is out of your reach

              J Offline
              J Offline
              jeron1
              wrote on last edited by
              #6

              Vasily Tserekh wrote:

              it has to give the output i less than 2 seconds

              Easy! :rolleyes: cout << "This may take several minutes to complete."; Now, you can take as long (almost) as you need.

              1 Reply Last reply
              0
              • S Slacker007

                Vasily Tserekh wrote:

                there is always some problem to solve that is out of your reach

                I think this is what keeps us moving in a forward direction.

                "the meat from that butcher is just the dogs danglies, absolutely amazing cuts of beef." - DaveAuld (2011)
                "No, that is just the earthly manifestation of the Great God Retardon." - Nagy Vilmos (2011) "It is the celestial scrotum of good luck!" - Nagy Vilmos (2011) "But you probably have the smoothest scrotum of any grown man" - Pete O'Hanlon (2012)

                Mike HankeyM Offline
                Mike HankeyM Offline
                Mike Hankey
                wrote on last edited by
                #7

                The old carrot on a stick paradigm?

                VS2010/Atmel Studio 6.0 ToDo Manager Extension
                Version 3.0 now available. There is no place like 127.0.0.1

                1 Reply Last reply
                0
                • A AspDotNetDev

                  Vasily Tserekh wrote:

                  can you think in a solution?

                  I'm not sure how fast it will run (and it depends on the computer), but... Pick a point. Sort the remaining points into a binary tree based on distance from the first point. If any are equal distance, that's an isosceles triangle (so, increment). Repeat, picking each of the rest of the points as the center.

                  Thou mewling ill-breeding pignut!

                  A Offline
                  A Offline
                  AspDotNetDev
                  wrote on last edited by
                  #8

                  This would run in O(N2log(N)). For 1,000 points, that is about 32,000,000 operations. I suspect that would run in under 2 seconds on a 2009 desktop computer.

                  Thou mewling ill-breeding pignut!

                  1 Reply Last reply
                  0
                  • V Vasily Tserekh

                    It was the year 2009 when I went to the regionals of the ACM-IBM programming contest thats when I saw what i thinked the easiest problem. I give you a set of 2D points(1000 max) and the output is how many isoceles triangles can be formed with those points. Later on I realized that problem was trap it has to give the output i less than 2 seconds can you think in a solution? I did later after six hours sitting on my PC That teach me something I will never forget. No matter how great programmer you think you are there is always some problem to solve that is out of your reach

                    K Offline
                    K Offline
                    KChandos
                    wrote on last edited by
                    #9

                    Gotta love problems like that! I used to work for a company that provides custom mainframe solutions in ADABAS / Natural. One day the company president posed a simple challenge to all of the programmers: Written entirely in Natural, divide a 100 digit number by a 50 digit number. Sounded easy enough, took a little longer than I anticipated (by a couple of hours), but I and one other programmer were able to submit working solutions. Challenges like that definately keep us on our toes!

                    1 Reply Last reply
                    0
                    • V Vasily Tserekh

                      It was the year 2009 when I went to the regionals of the ACM-IBM programming contest thats when I saw what i thinked the easiest problem. I give you a set of 2D points(1000 max) and the output is how many isoceles triangles can be formed with those points. Later on I realized that problem was trap it has to give the output i less than 2 seconds can you think in a solution? I did later after six hours sitting on my PC That teach me something I will never forget. No matter how great programmer you think you are there is always some problem to solve that is out of your reach

                      S Offline
                      S Offline
                      Stephan A
                      wrote on last edited by
                      #10

                      Quote:

                      No matter how great programmer you think you are there is always some problem to solve that is out of your reach

                      I agree with some previous replies; that one should move forward. But to encourage you even more :D I will tell you that there are problems which probably you won't even solve :) http://en.wikipedia.org/wiki/List_of_unsolved_problems_in_computer_science[^]

                      best regards.

                      B 1 Reply Last reply
                      0
                      • W wizardzz

                        That's why managers pad inexperienced programmers' time estimates. Realizing the complexity of a problem from the beginning is another skill to develop, as important as constructing algorithms. I am in no way implying you are inexperienced.

                        B Offline
                        B Offline
                        BillWoodruff
                        wrote on last edited by
                        #11

                        I think you "speak truth to power" here brother WizardZZ, but, I also think there are often other motivations, of a darker flavor, at work in the padding of time estimates by managers. best, Bill

                        "The greatest mystery is not that we have been flung at random between the profusion of matter and of the stars, but that within this prison we can draw from ourselves images powerful enough to deny our nothingness." Andre Malraux

                        W 1 Reply Last reply
                        0
                        • S Stephan A

                          Quote:

                          No matter how great programmer you think you are there is always some problem to solve that is out of your reach

                          I agree with some previous replies; that one should move forward. But to encourage you even more :D I will tell you that there are problems which probably you won't even solve :) http://en.wikipedia.org/wiki/List_of_unsolved_problems_in_computer_science[^]

                          best regards.

                          B Offline
                          B Offline
                          BillWoodruff
                          wrote on last edited by
                          #12

                          Oh boy, there are so many problems that are "out of my reach" that I have to survive eating the rotten problems that fall out of the tree by accident, including the worms in them :) The theory of NP-Hard problems is an interesting area to examine in the context of your remarks:[^]. And, then I suppose there are problems that are insoluble: like, perhaps: prove that Godel's theorem that there is no system of logic which cannot be used to construct a self-contradictory statement ... is incorrect ? Or, a little more "mundanely:" prove you can understand what someone you are "in love with" really feels. best, Bill

                          "The greatest mystery is not that we have been flung at random between the profusion of matter and of the stars, but that within this prison we can draw from ourselves images powerful enough to deny our nothingness." Andre Malraux

                          S 1 Reply Last reply
                          0
                          • B BillWoodruff

                            Oh boy, there are so many problems that are "out of my reach" that I have to survive eating the rotten problems that fall out of the tree by accident, including the worms in them :) The theory of NP-Hard problems is an interesting area to examine in the context of your remarks:[^]. And, then I suppose there are problems that are insoluble: like, perhaps: prove that Godel's theorem that there is no system of logic which cannot be used to construct a self-contradictory statement ... is incorrect ? Or, a little more "mundanely:" prove you can understand what someone you are "in love with" really feels. best, Bill

                            "The greatest mystery is not that we have been flung at random between the profusion of matter and of the stars, but that within this prison we can draw from ourselves images powerful enough to deny our nothingness." Andre Malraux

                            S Offline
                            S Offline
                            Stephan A
                            wrote on last edited by
                            #13

                            Hey, I am not familiar with Godels theorem. However, indeed the fact that such problems exist (e.g., NP) and haven't been solved for such a long time, suggest how complicated they really are

                            best regards.

                            1 Reply Last reply
                            0
                            • B BillWoodruff

                              I think you "speak truth to power" here brother WizardZZ, but, I also think there are often other motivations, of a darker flavor, at work in the padding of time estimates by managers. best, Bill

                              "The greatest mystery is not that we have been flung at random between the profusion of matter and of the stars, but that within this prison we can draw from ourselves images powerful enough to deny our nothingness." Andre Malraux

                              W Offline
                              W Offline
                              wizardzz
                              wrote on last edited by
                              #14

                              True, I agree. I was speaking from experience. 2 jobs ago, I was in charge of a junior developer and she would give really short time estimates to everything, but there were times I realized the complexity of what I was assigning her, so I would pad her estimates for her short-sided-ness.

                              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