|
Posted on
2006-10-17 15:02
laifangsong
阅读( 516)
评论()
编辑
收藏
举报
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
<%
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
'递归实现无重复组合
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
Dim aNum
aNum = Array("1","2","3","4")
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
Call Combination(0, aNum, "")
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
Function Combination(n_Cur, a_Num, s)
Dim i, bound
bound = UBound(a_Num)
If n_Cur > bound Then
Response.Write s & "<br />"
Exit Function
End If
For i = 0 To bound
If IsExists(s, a_Num(i)) = False Then
Call Combination(n_Cur+1, a_Num, s & a_Num(i))
End If
Next
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
Function IsExists(s_Parent, s_Sub)
If InStr(s_Parent, s_Sub) > 0 Then
IsExists = True
Else
IsExists = False
End If
End Function
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
%>
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
|