排列组合算法如何实现 一维数组 中元素的排列组合,并将其排列组合的所有情况输出?如:一个字符串数组 ABC;排列后输出:
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/10 15:58:19
排列组合算法
如何实现 一维数组 中元素的排列组合,并将其排列组合的所有情况输出?
如:一个字符串数组 ABC;
排列后输出:ABC
ACB
BAC
BCA
CAB
CBA
我说的是用计算机代码表示的算法!不是怎么算!阶乘计算我会!
如何实现 一维数组 中元素的排列组合,并将其排列组合的所有情况输出?
如:一个字符串数组 ABC;
排列后输出:ABC
ACB
BAC
BCA
CAB
CBA
我说的是用计算机代码表示的算法!不是怎么算!阶乘计算我会!
可用递归算法 实现N重循环 来实现
详细请QQ :115499275
以下也许有助于你
以下为文件的内容:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 8115
ClientLeft = 60
ClientTop = 345
ClientWidth = 5760
LinkTopic = "Form1"
ScaleHeight = 8115
ScaleWidth = 5760
StartUpPosition = 3 '窗口缺省
Begin VB.ComboBox Combo1
Height = 300
Left = 4200
TabIndex = 2
Text = "Combo1"
Top = 960
Width = 1215
End
Begin VB.TextBox Text1
Height = 7455
Left = 120
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 1
Text = "Form1.frx":0000
Top = 120
Width = 3855
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 495
Left = 4200
TabIndex = 0
Top = 120
Width = 1215
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Pwd As String
Function NFormM(ByVal iStart As Integer,iEnd As Integer,Num As Integer,Optional Str As String)
Dim i As Integer
If Num = 0 Then
With Text1
.Text = Text1.Text & Str & vbNewLine
.SelStart = Len(.Text)
End With
Else
For i = iStart To iEnd
DoEvents
NFormM i + 1,iEnd,Num - 1,Str & Mid(Pwd,i,1)
Next
End If
End Function
Private Sub Command1_Click()
Dim out(),i As Integer,s As String
Text1.Text = ""
NFormM 1,Len(Pwd),Val(Combo1.Text)
End Sub
Private Sub Form_Load()
Dim i As Integer
With Combo1
For i = 1 To 12
.AddItem i
Pwd = Pwd & Chr(64 + i)
Next
Print Pwd
End With
End Su
详细请QQ :115499275
以下也许有助于你
以下为文件的内容:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 8115
ClientLeft = 60
ClientTop = 345
ClientWidth = 5760
LinkTopic = "Form1"
ScaleHeight = 8115
ScaleWidth = 5760
StartUpPosition = 3 '窗口缺省
Begin VB.ComboBox Combo1
Height = 300
Left = 4200
TabIndex = 2
Text = "Combo1"
Top = 960
Width = 1215
End
Begin VB.TextBox Text1
Height = 7455
Left = 120
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 1
Text = "Form1.frx":0000
Top = 120
Width = 3855
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 495
Left = 4200
TabIndex = 0
Top = 120
Width = 1215
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Pwd As String
Function NFormM(ByVal iStart As Integer,iEnd As Integer,Num As Integer,Optional Str As String)
Dim i As Integer
If Num = 0 Then
With Text1
.Text = Text1.Text & Str & vbNewLine
.SelStart = Len(.Text)
End With
Else
For i = iStart To iEnd
DoEvents
NFormM i + 1,iEnd,Num - 1,Str & Mid(Pwd,i,1)
Next
End If
End Function
Private Sub Command1_Click()
Dim out(),i As Integer,s As String
Text1.Text = ""
NFormM 1,Len(Pwd),Val(Combo1.Text)
End Sub
Private Sub Form_Load()
Dim i As Integer
With Combo1
For i = 1 To 12
.AddItem i
Pwd = Pwd & Chr(64 + i)
Next
Print Pwd
End With
End Su
排列组合算法如何实现 一维数组 中元素的排列组合,并将其排列组合的所有情况输出?如:一个字符串数组 ABC;排列后输出:
已知一个长度为100的一维数组,求数组中所有元素平均值并输出.
用c++如何编程 将1--1000中所有21的倍数存到一个一维数组中,并输出该数组的所有数据.
C 语言 一维整形数组将数组元素逆序存放并把交换后的数组输出 要求数组元素的输入,交换和输出分别用函数
将1--1000中所有21的倍数存到一个一维数组中,并输出该数组的所有数据.请问如下哪里错了?
将30个整数存放于一维数组a中,把其中所有能同时被3和7整除的数依次存入数组b,并按每行最多3个元素格式输出b
如何实现0,1,3这三个数组合成所有14位数字并将所有的结果输出?Java实现!例如:01301301301301,
任意数字序列“123456”之类,输出他们所有的排列组合
用java创建一个包含5个元素的List集合,然后将该List集合转换为数组,并输出转 换后的数组.
C++如何描述“屏幕输出1—9这九个数字所有排列组合”?1-n的所有排列组合输出怎么写?求代码,
有一个包含了n个字符的字符串.编写一个函数,将此字符串从头开始共m个字符作为一个子字符串复制到另一个字符数组中,并输出该
定义一个整形数组,求出数组元素的和,数组元素的最大值和最小值,并输出所求的结