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. General Programming
  3. Algorithms
  4. How to find permutations

How to find permutations

Scheduled Pinned Locked Moved Algorithms
tutorial
10 Posts 4 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.
  • M Offline
    M Offline
    Mushtaque Nizamani
    wrote on last edited by
    #1

    How to find all possible permutations from a nth set of characters with kth number, for example to find 2 number permutation from 3 characters. abc all possible permutation are here. ab ba ac ca bc cb Warm Regards, Mushq

    B D U 3 Replies Last reply
    0
    • M Mushtaque Nizamani

      How to find all possible permutations from a nth set of characters with kth number, for example to find 2 number permutation from 3 characters. abc all possible permutation are here. ab ba ac ca bc cb Warm Regards, Mushq

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

      s = {a1, ..., an}. Loop i1 from 1 to n. . . . Loop ik from 1 to n. Flag each character as being used or not and skip it if it is being used. Concatenate si1...sik. If any sim is empty for 1 ≤ m ≤ k, then skip it. This gives all permutatons of length k.


      "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

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

        s = {a1, ..., an}. Loop i1 from 1 to n. . . . Loop ik from 1 to n. Flag each character as being used or not and skip it if it is being used. Concatenate si1...sik. If any sim is empty for 1 ≤ m ≤ k, then skip it. This gives all permutatons of length k.


        "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

        M Offline
        M Offline
        Mushtaque Nizamani
        wrote on last edited by
        #3

        If any sim is empty for 1 ≤ m ≤ k, then skip it.? Sorry friend i couldn't understand the above sentence, can you please elobrate that.

        B U 2 Replies Last reply
        0
        • M Mushtaque Nizamani

          If any sim is empty for 1 ≤ m ≤ k, then skip it.? Sorry friend i couldn't understand the above sentence, can you please elobrate that.

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

          Assume you had the last L bits flagged as used for the first L iterations (iL), and for the (L+1)st bit you were in the (K-L+1)th position or higher, then all of the characters after this starting position are in use and your character will be empty, so skip the concatenation.


          "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

          U 1 Reply Last reply
          0
          • M Mushtaque Nizamani

            How to find all possible permutations from a nth set of characters with kth number, for example to find 2 number permutation from 3 characters. abc all possible permutation are here. ab ba ac ca bc cb Warm Regards, Mushq

            D Offline
            D Offline
            djlove
            wrote on last edited by
            #5

            You might be interested in this: http://en.wikipedia.org/wiki/Factoradic [^] and there is also some code at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/permutations.asp [^] This is a very good and general way of calculating Permutations, hope this helps!

            U 1 Reply Last reply
            0
            • D djlove

              You might be interested in this: http://en.wikipedia.org/wiki/Factoradic [^] and there is also some code at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/permutations.asp [^] This is a very good and general way of calculating Permutations, hope this helps!

              U Offline
              U Offline
              User 12346520
              wrote on last edited by
              #6

              thanks: https://movied.org

              1 Reply Last reply
              0
              • B Bassam Abdul Baki

                Assume you had the last L bits flagged as used for the first L iterations (iL), and for the (L+1)st bit you were in the (K-L+1)th position or higher, then all of the characters after this starting position are in use and your character will be empty, so skip the concatenation.


                "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

                U Offline
                U Offline
                User 12346520
                wrote on last edited by
                #7

                thanks: https://movied.org

                1 Reply Last reply
                0
                • M Mushtaque Nizamani

                  If any sim is empty for 1 ≤ m ≤ k, then skip it.? Sorry friend i couldn't understand the above sentence, can you please elobrate that.

                  U Offline
                  U Offline
                  User 12346520
                  wrote on last edited by
                  #8

                  thanks: https://movied.org

                  1 Reply Last reply
                  0
                  • B Bassam Abdul Baki

                    s = {a1, ..., an}. Loop i1 from 1 to n. . . . Loop ik from 1 to n. Flag each character as being used or not and skip it if it is being used. Concatenate si1...sik. If any sim is empty for 1 ≤ m ≤ k, then skip it. This gives all permutatons of length k.


                    "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

                    U Offline
                    U Offline
                    User 12346520
                    wrote on last edited by
                    #9

                    thanks: https://movied.org

                    1 Reply Last reply
                    0
                    • M Mushtaque Nizamani

                      How to find all possible permutations from a nth set of characters with kth number, for example to find 2 number permutation from 3 characters. abc all possible permutation are here. ab ba ac ca bc cb Warm Regards, Mushq

                      U Offline
                      U Offline
                      User 12346520
                      wrote on last edited by
                      #10

                      thanks: https://movied.org

                      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