一个排列问题:
给定集合 {a,b,c},其全排列为:
abc
acb
bac
bca
cab
cba
如何写一个程序,打印一个给定集合,如:
{'1','2','3','4','5','6','7'}
的全排列?
程序作者:y0h
<%
Dim Max,Str1
Dim sArray
Str1=","
sArray=Split("a,b,c,d,e,f,g,h",",")
Max=Ubound(sArray)
Test Max,Max,Str1
Function Test(Max,x,Str1)
If x>=0 Then
For I=0 to Max
If Instr(Str1,","&sArray(i)&",")=0 Then
Test Max,x-1,Str1&sArray(i)&","
End IF
Next
Else
Response.Write(Str1&"<BR>")
End IF
End Function
%>