Permutation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lucotuslim

    Permutation

    Hi,
    Need help to permutate all the posible combination of string for example

    Dim arr(2) As String
    arr(0) = "A"
    arr(1) = "B"
    arr(2) = "C"

    I need the list of posible combination like "ABC" , "ACB", ... etc

    Thanks.
    --
    Lucotus
  • Stephany Young

    #2
    Re: Permutation

    Dim arr(2,2) As String

    arr(0,0) = "A"
    arr(0,1) = "B"
    arr(0,2) = "C"
    arr(1,0) = "A"
    arr(1,1) = "B"
    arr(1,2) = "C"
    arr(2,0) = "A"
    arr(2,1) = "B"
    arr(2,2) = "C"

    For _i As Integer = 0 To 2
    For _j As Integer = 0 To 2
    For _k As Integer = 0 To 2
    Console.Writeli ne(arr(_i,_i) & arr(_i,_j) & arr(_i,_k))
    Next
    Next
    Next

    "lucotuslim " <lucotuslim@hot mail.com> wrote in message
    news:956C5A5F-ACA9-4E02-952C-78F5F7C525B6@mi crosoft.com...[color=blue]
    > Hi,
    > Need help to permutate all the posible combination of string for example
    >
    > Dim arr(2) As String
    > arr(0) = "A"
    > arr(1) = "B"
    > arr(2) = "C"
    >
    > I need the list of posible combination like "ABC" , "ACB", ... etc
    >
    > Thanks.
    > --
    > Lucotus[/color]


    Comment

    • Stephany Young

      #3
      Re: Permutation

      Dim arr(2,2) As String

      arr(0,0) = "A"
      arr(0,1) = "B"
      arr(0,2) = "C"
      arr(1,0) = "A"
      arr(1,1) = "B"
      arr(1,2) = "C"
      arr(2,0) = "A"
      arr(2,1) = "B"
      arr(2,2) = "C"

      For _i As Integer = 0 To 2
      For _j As Integer = 0 To 2
      For _k As Integer = 0 To 2
      Console.Writeli ne(arr(_i,_i) & arr(_i,_j) & arr(_i,_k))
      Next
      Next
      Next

      "lucotuslim " <lucotuslim@hot mail.com> wrote in message
      news:956C5A5F-ACA9-4E02-952C-78F5F7C525B6@mi crosoft.com...[color=blue]
      > Hi,
      > Need help to permutate all the posible combination of string for example
      >
      > Dim arr(2) As String
      > arr(0) = "A"
      > arr(1) = "B"
      > arr(2) = "C"
      >
      > I need the list of posible combination like "ABC" , "ACB", ... etc
      >
      > Thanks.
      > --
      > Lucotus[/color]


      Comment

      • Nick Malik [Microsoft]

        #4
        Re: Permutation

        Hi Stephany,

        On this and similar forums, it is seen as bad form to answer homework
        questions. Let's try to avoid doing that, OK?

        --
        --- Nick Malik [Microsoft]
        MCSD, CFPS, Certified Scrummaster


        Disclaimer: Opinions expressed in this forum are my own, and not
        representative of my employer.
        I do not answer questions on behalf of my employer. I'm just a
        programmer helping programmers.
        --
        "Stephany Young" <noone@localhos t> wrote in message
        news:u59jvjOoFH A.3608@TK2MSFTN GP15.phx.gbl...[color=blue]
        > Dim arr(2,2) As String
        >
        > arr(0,0) = "A"
        > arr(0,1) = "B"
        > arr(0,2) = "C"
        > arr(1,0) = "A"
        > arr(1,1) = "B"
        > arr(1,2) = "C"
        > arr(2,0) = "A"
        > arr(2,1) = "B"
        > arr(2,2) = "C"
        >
        > For _i As Integer = 0 To 2
        > For _j As Integer = 0 To 2
        > For _k As Integer = 0 To 2
        > Console.Writeli ne(arr(_i,_i) & arr(_i,_j) & arr(_i,_k))
        > Next
        > Next
        > Next
        >
        > "lucotuslim " <lucotuslim@hot mail.com> wrote in message
        > news:956C5A5F-ACA9-4E02-952C-78F5F7C525B6@mi crosoft.com...[color=green]
        >> Hi,
        >> Need help to permutate all the posible combination of string for example
        >>
        >> Dim arr(2) As String
        >> arr(0) = "A"
        >> arr(1) = "B"
        >> arr(2) = "C"
        >>
        >> I need the list of posible combination like "ABC" , "ACB", ... etc
        >>
        >> Thanks.
        >> --
        >> Lucotus[/color]
        >
        >[/color]


        Comment

        • Nick Malik [Microsoft]

          #5
          Re: Permutation

          Hi Stephany,

          On this and similar forums, it is seen as bad form to answer homework
          questions. Let's try to avoid doing that, OK?

          --
          --- Nick Malik [Microsoft]
          MCSD, CFPS, Certified Scrummaster


          Disclaimer: Opinions expressed in this forum are my own, and not
          representative of my employer.
          I do not answer questions on behalf of my employer. I'm just a
          programmer helping programmers.
          --
          "Stephany Young" <noone@localhos t> wrote in message
          news:u59jvjOoFH A.3608@TK2MSFTN GP15.phx.gbl...[color=blue]
          > Dim arr(2,2) As String
          >
          > arr(0,0) = "A"
          > arr(0,1) = "B"
          > arr(0,2) = "C"
          > arr(1,0) = "A"
          > arr(1,1) = "B"
          > arr(1,2) = "C"
          > arr(2,0) = "A"
          > arr(2,1) = "B"
          > arr(2,2) = "C"
          >
          > For _i As Integer = 0 To 2
          > For _j As Integer = 0 To 2
          > For _k As Integer = 0 To 2
          > Console.Writeli ne(arr(_i,_i) & arr(_i,_j) & arr(_i,_k))
          > Next
          > Next
          > Next
          >
          > "lucotuslim " <lucotuslim@hot mail.com> wrote in message
          > news:956C5A5F-ACA9-4E02-952C-78F5F7C525B6@mi crosoft.com...[color=green]
          >> Hi,
          >> Need help to permutate all the posible combination of string for example
          >>
          >> Dim arr(2) As String
          >> arr(0) = "A"
          >> arr(1) = "B"
          >> arr(2) = "C"
          >>
          >> I need the list of posible combination like "ABC" , "ACB", ... etc
          >>
          >> Thanks.
          >> --
          >> Lucotus[/color]
          >
          >[/color]


          Comment

          Working...