Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • 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

The New Coffee Room

  1. TNCR
  2. General Discussion
  3. Puzzle time - Sorting the Horses

Puzzle time - Sorting the Horses

Scheduled Pinned Locked Moved General Discussion
11 Posts 4 Posters 79 Views
  • 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.
  • KlausK Offline
    KlausK Offline
    Klaus
    wrote on last edited by Klaus
    #1

    There are 25 horses in a race and your job is to determine a complete ranking of those 25 horses by their speed.

    However, the racing circuit is so small that only two horses can race at a time. You don't have a stopwatch, as Jon says, so you can only observe which horse is faster.

    How many races do you need in the worst case to determine the complete ranking? How about the average case?

    Somebody claims that he can always determine the ranking that way with 60 or less races. Could he possibly say the truth?

    1 Reply Last reply
    • jon-nycJ Offline
      jon-nycJ Offline
      jon-nyc
      wrote on last edited by jon-nyc
      #2

      This is just the standard sorting problem there's a whole wiki page about the methods.

      Only non-witches get due process.

      • Cotton Mather, Salem Massachusetts, 1692
      1 Reply Last reply
      • KlausK Offline
        KlausK Offline
        Klaus
        wrote on last edited by Klaus
        #3

        No, it's not.

        The number of horses if fixed, hence standard algorithms don't give the optimal result. Also, standard algorithms only give you upper bounds but not lower bounds.

        The optimal solution is in fact at this point unknown. I believe provably optimal solutions are only known for up to 16 horses currently.

        But I think I'll make the problem a bit simpler and more tractable.

        KlausK 1 Reply Last reply
        • KlausK Klaus

          No, it's not.

          The number of horses if fixed, hence standard algorithms don't give the optimal result. Also, standard algorithms only give you upper bounds but not lower bounds.

          The optimal solution is in fact at this point unknown. I believe provably optimal solutions are only known for up to 16 horses currently.

          But I think I'll make the problem a bit simpler and more tractable.

          KlausK Offline
          KlausK Offline
          Klaus
          wrote on last edited by Klaus
          #4

          @klaus said in Puzzle time - Sorting the Horses:

          I believe provably optimal solutions are only known for up to 16 horses currently.

          I looked it up. It's even worse. An optimal (minimal in the number of races) solution is only known for up to 12 horses, and this result has been established rather recently, in December 2019.

          So, there would be ample room for human creativity in this task 🙂

          You are right that sorting is boring and basically "solved" when considering inputs of variable size and asymptotic complexity measures. But for concrete inputs, like in my example, it's very different. Your original puzzle would also be very boring when you consider the generalized case of n horses and asymptotic bounds: the asymptotic bound would simply be "linear in the number of horses".

          My last question could have been answered in the negative by an information-theoretic argument.

          1 Reply Last reply
          • taiwan_girlT Offline
            taiwan_girlT Offline
            taiwan_girl
            wrote on last edited by
            #5

            In my feeble mind, I would have 1 race 2, then 2 race 3, 3 race 4, 4 race 5,etc. to get a "semi baseline"

            Once you have establish this, you would do it again with a lesser number of races and kind of pyramid it to set the rankings.

            No idea how many races this would take however.

            KlausK 2 Replies Last reply
            • taiwan_girlT taiwan_girl

              In my feeble mind, I would have 1 race 2, then 2 race 3, 3 race 4, 4 race 5,etc. to get a "semi baseline"

              Once you have establish this, you would do it again with a lesser number of races and kind of pyramid it to set the rankings.

              No idea how many races this would take however.

              KlausK Offline
              KlausK Offline
              Klaus
              wrote on last edited by
              #6

              @taiwan_girl said in Puzzle time - Sorting the Horses:

              In my feeble mind, I would have 1 race 2, then 2 race 3, 3 race 4, 4 race 5,etc. to get a "semi baseline"

              Once you have establish this, you would do it again with a lesser number of races and kind of pyramid it to set the rankings.

              No idea how many races this would take however.

              If you'd always swap places after each race when the horses are not in order, then your algorithm is known as "bubble sorting". You'd need about 25^2 / 2 races.

              alt text

              1 Reply Last reply
              • taiwan_girlT taiwan_girl

                In my feeble mind, I would have 1 race 2, then 2 race 3, 3 race 4, 4 race 5,etc. to get a "semi baseline"

                Once you have establish this, you would do it again with a lesser number of races and kind of pyramid it to set the rankings.

                No idea how many races this would take however.

                KlausK Offline
                KlausK Offline
                Klaus
                wrote on last edited by
                #7

                @taiwan_girl Here's a nice notation for your strategy that doesn't require any computer code. This is your strategy when there are 6 horses. Every horizontal line represents a horse. Every connection between the horizontal lines represents a race. If the race result determines that the horses are not in order, they swap places.

                alt text

                As you can see, 15 races are required with that strategy.

                However, the optimal strategy requires only 12 races. Can you find it?

                taiwan_girlT 1 Reply Last reply
                • KlausK Klaus

                  @taiwan_girl Here's a nice notation for your strategy that doesn't require any computer code. This is your strategy when there are 6 horses. Every horizontal line represents a horse. Every connection between the horizontal lines represents a race. If the race result determines that the horses are not in order, they swap places.

                  alt text

                  As you can see, 15 races are required with that strategy.

                  However, the optimal strategy requires only 12 races. Can you find it?

                  taiwan_girlT Offline
                  taiwan_girlT Offline
                  taiwan_girl
                  wrote on last edited by
                  #8

                  @Kalus Thanks! Very thought making!

                  I will have to think about how to develop the 12 race scenario!!!

                  jon-nycJ 1 Reply Last reply
                  • taiwan_girlT taiwan_girl

                    @Kalus Thanks! Very thought making!

                    I will have to think about how to develop the 12 race scenario!!!

                    jon-nycJ Offline
                    jon-nycJ Offline
                    jon-nyc
                    wrote on last edited by
                    #9

                    @taiwan_girl said in Puzzle time - Sorting the Horses:

                    @Kalus Thanks! Very thought making!

                    By the way, “Kalus” is Taiwanese for “shit pianist”.

                    Only non-witches get due process.

                    • Cotton Mather, Salem Massachusetts, 1692
                    taiwan_girlT George KG 2 Replies Last reply
                    • jon-nycJ jon-nyc

                      @taiwan_girl said in Puzzle time - Sorting the Horses:

                      @Kalus Thanks! Very thought making!

                      By the way, “Kalus” is Taiwanese for “shit pianist”.

                      taiwan_girlT Offline
                      taiwan_girlT Offline
                      taiwan_girl
                      wrote on last edited by
                      #10

                      @jon-nyc 😂

                      1 Reply Last reply
                      • jon-nycJ jon-nyc

                        @taiwan_girl said in Puzzle time - Sorting the Horses:

                        @Kalus Thanks! Very thought making!

                        By the way, “Kalus” is Taiwanese for “shit pianist”.

                        George KG Offline
                        George KG Offline
                        George K
                        wrote on last edited by
                        #11

                        @jon-nyc said in Puzzle time - Sorting the Horses:

                        By the way, “Kalus” is Taiwanese for “shit pianist”.

                        Thank goodness I have a spare keyboard!

                        "Now look here, you Baltic gas passer... " - Mik, 6/14/08

                        The saying, "Lite is just one damn thing after another," is a gross understatement. The damn things overlap.

                        1 Reply Last reply
                        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
                        • Users
                        • Groups