Get permutation

andrea93

Member
Hello,
I must, given a data table of n elements, generate all the possible combinations


ex.

DtIn: 1
2

out: 12 ;21
 

gil.silva

Active Member
Hello,

You can use some already-done code such as:
Code:
Public Class Form1
    Dim data_array As String() = {"one", "two", "three", "four", "five", "six"}
    Dim buffer As New List(Of String)

Public Sub Permute(ByVal Root As String, ByVal Depth As Integer, ByVal Buffer As List(Of String))

    For Each myStr As String In data_array

            If Depth <= 1 Then
                Buffer.Add(Root + myStr)
            Else
                Permute(Root + myStr, Depth - 1, Buffer)
            End If

    Next

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Permute("", 2, buffer)
End Sub
End Class

And create a Code stage in BP to accomplish what you need.
 

andrea93

Member
Hello,

You can use some already-done code such as:
Code:
Public Class Form1
    Dim data_array As String() = {"one", "two", "three", "four", "five", "six"}
    Dim buffer As New List(Of String)

Public Sub Permute(ByVal Root As String, ByVal Depth As Integer, ByVal Buffer As List(Of String))

    For Each myStr As String In data_array

            If Depth <= 1 Then
                Buffer.Add(Root + myStr)
            Else
                Permute(Root + myStr, Depth - 1, Buffer)
            End If

    Next

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Permute("", 2, buffer)
End Sub
End Class

And create a Code stage in BP to accomplish what you need.

What are input and output variable?
 
Top