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. Programming chalenge: Bogosort

Programming chalenge: Bogosort

Scheduled Pinned Locked Moved The Lounge
c++algorithmscsharplounge
24 Posts 15 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.
  • J Jim Crafton

    Me!?? Are you out of your mind?! That's absurd.

    ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Blow

    A Offline
    A Offline
    Andy Brummer
    wrote on last edited by
    #11

    Fiend! You accuse me of writing farcebook games, and you go around brazenly wikiediting. Shame shame.

    Curvature of the Mind

    J 1 Reply Last reply
    0
    • A Andy Brummer

      Fiend! You accuse me of writing farcebook games, and you go around brazenly wikiediting. Shame shame.

      Curvature of the Mind

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

      Speak not such foul language Lord Farcebook! Calm your self and realize only thusly: the spoon which you think you doth perceive, cast not it's silvry glint upon thine mind's eye! Think well upon this my friend, and perhaps you may yet take back your rough and uncouth words.

      ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Blow

      H 1 Reply Last reply
      0
      • N Nemanja Trifunovic

        Just learned about the best sorting algorithm ever: Bogosort[^] Here is my implementation in C++ (note use of C++0x is_sorted algorithm):

        template <class RandomAccessIterator, class Compare>
        void bogo_sort (RandomAccessIterator first, RandomAccessIterator last, Compare comp)
        {
        while (!is_sorted(first, last, comp))
        random_shuffle(first, last);
        }

        utf8-cpp

        G Offline
        G Offline
        Gary R Wheeler
        wrote on last edited by
        #13

        I prefer this[^] sorting algorithm myself.

        Software Zen: delete this;
        Fold With Us![^]

        H 1 Reply Last reply
        0
        • J Jim Crafton

          Speak not such foul language Lord Farcebook! Calm your self and realize only thusly: the spoon which you think you doth perceive, cast not it's silvry glint upon thine mind's eye! Think well upon this my friend, and perhaps you may yet take back your rough and uncouth words.

          ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Blow

          H Offline
          H Offline
          Henry Minute
          wrote on last edited by
          #14

          Is this a spoon I see before me?

          Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus! When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.

          D 1 Reply Last reply
          0
          • G Gary R Wheeler

            I prefer this[^] sorting algorithm myself.

            Software Zen: delete this;
            Fold With Us![^]

            H Offline
            H Offline
            Henry Minute
            wrote on last edited by
            #15

            Why, I outta...........!

            Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus! When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.

            G 1 Reply Last reply
            0
            • J Jim Crafton

              Dude, haven't you heard? The best sorting is probably found in Qt!!!

              ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Blow

              N Offline
              N Offline
              Nemanja Trifunovic
              wrote on last edited by
              #16

              Jim Crafton wrote:

              The best sorting is probably found in Qt!!!

              :-D And I bet it is twice as efficient as bogosort.

              utf8-cpp

              1 Reply Last reply
              0
              • H Henry Minute

                Why, I outta...........!

                Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus! When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.

                G Offline
                G Offline
                Gary R Wheeler
                wrote on last edited by
                #17

                Woo-woo-woo!

                Software Zen: delete this;
                Fold With Us![^]

                1 Reply Last reply
                0
                • N Nemanja Trifunovic

                  Just learned about the best sorting algorithm ever: Bogosort[^] Here is my implementation in C++ (note use of C++0x is_sorted algorithm):

                  template <class RandomAccessIterator, class Compare>
                  void bogo_sort (RandomAccessIterator first, RandomAccessIterator last, Compare comp)
                  {
                  while (!is_sorted(first, last, comp))
                  random_shuffle(first, last);
                  }

                  utf8-cpp

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

                  Most guys would tell you the QuickieSort is the fastest.

                  1 Reply Last reply
                  0
                  • N Nemanja Trifunovic

                    Just learned about the best sorting algorithm ever: Bogosort[^] Here is my implementation in C++ (note use of C++0x is_sorted algorithm):

                    template <class RandomAccessIterator, class Compare>
                    void bogo_sort (RandomAccessIterator first, RandomAccessIterator last, Compare comp)
                    {
                    while (!is_sorted(first, last, comp))
                    random_shuffle(first, last);
                    }

                    utf8-cpp

                    N Offline
                    N Offline
                    NetDave
                    wrote on last edited by
                    #19

                    I'd love to see this sort algorithm visually[^]

                    QRZ? de WAØTTN

                    D P 2 Replies Last reply
                    0
                    • J Jim Crafton

                      Dude, haven't you heard? The best sorting is probably found in Qt!!!

                      ¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Blow

                      M Offline
                      M Offline
                      Mladen Jankovic
                      wrote on last edited by
                      #20

                      :-D

                      [Genetic Algorithm Library] [Wowd]

                      1 Reply Last reply
                      0
                      • N NetDave

                        I'd love to see this sort algorithm visually[^]

                        QRZ? de WAØTTN

                        D Offline
                        D Offline
                        Dan Neely
                        wrote on last edited by
                        #21

                        Nice. :cool:

                        3x12=36 2x12=24 1x12=12 0x12=18

                        1 Reply Last reply
                        0
                        • N NetDave

                          I'd love to see this sort algorithm visually[^]

                          QRZ? de WAØTTN

                          P Offline
                          P Offline
                          peterchen
                          wrote on last edited by
                          #22

                          here you go![^]

                          FILETIME to time_t
                          | FoldWithUs! | sighist | WhoIncludes - Analyzing C++ include file hierarchy

                          1 Reply Last reply
                          0
                          • N Nemanja Trifunovic

                            Just learned about the best sorting algorithm ever: Bogosort[^] Here is my implementation in C++ (note use of C++0x is_sorted algorithm):

                            template <class RandomAccessIterator, class Compare>
                            void bogo_sort (RandomAccessIterator first, RandomAccessIterator last, Compare comp)
                            {
                            while (!is_sorted(first, last, comp))
                            random_shuffle(first, last);
                            }

                            utf8-cpp

                            B Offline
                            B Offline
                            Bminas
                            wrote on last edited by
                            #23

                            I believe that this falls under the group of algorithms known as pessimal. For the academic treatment, please see: http://www.bowdoin.edu/~ltoma/teaching/cs231/fall03/broder86pessimal.pdf[^]

                            1 Reply Last reply
                            0
                            • H Henry Minute

                              Is this a spoon I see before me?

                              Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.” I wouldn't let CG touch my Abacus! When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.

                              D Offline
                              D Offline
                              djdanlib 0
                              wrote on last edited by
                              #24

                              Perhaps it is a spoony bard?

                              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