文件名称:comb
- 所属分类:
- 其他小程序
- 资源属性:
- [Windows] [Visual C] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 183kb
- 下载次数:
- 0次
- 提 供 者:
- yan****
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
一、 程序作用
实现排列组合功能。
例如:如果允许出现的数字为1 2 3 4 ,每个组合有3个元素,则输出的组合为
(1 2 3) (1 2 4) (1 3 4) (2 3 4)
二、 算法实现
采用栈的思想,首先输入第一个组合(1 2 3…..r) 如果r<n,则r弹栈,把r=r+1压栈,如果r=n,则r弹栈,同时把前一项也弹栈,再依次增加,直到出现组合
(n-r+1 n-r+2 ….n).
-First, procedures for the functional role of the realization of permutation and combination. For example: if allowed the figures for 1 2 3 4, each portfolio has three elements, then the composition of output (1 2 3) (1 2 4) (1 3 4) (2 3 4) Second, algorithms to achieve the idea of using the stack, the first importation of the first combination (1 2 3 ... .. r) if r <n, then r shells stack, and r = r+ 1 push, if r = n, then r shells stack, at the same time before a bomb also stack, and then followed by an increase until the emergence of combination (n-r+ 1 n-r+ 2 .... n).
实现排列组合功能。
例如:如果允许出现的数字为1 2 3 4 ,每个组合有3个元素,则输出的组合为
(1 2 3) (1 2 4) (1 3 4) (2 3 4)
二、 算法实现
采用栈的思想,首先输入第一个组合(1 2 3…..r) 如果r<n,则r弹栈,把r=r+1压栈,如果r=n,则r弹栈,同时把前一项也弹栈,再依次增加,直到出现组合
(n-r+1 n-r+2 ….n).
-First, procedures for the functional role of the realization of permutation and combination. For example: if allowed the figures for 1 2 3 4, each portfolio has three elements, then the composition of output (1 2 3) (1 2 4) (1 3 4) (2 3 4) Second, algorithms to achieve the idea of using the stack, the first importation of the first combination (1 2 3 ... .. r) if r <n, then r shells stack, and r = r+ 1 push, if r = n, then r shells stack, at the same time before a bomb also stack, and then followed by an increase until the emergence of combination (n-r+ 1 n-r+ 2 .... n).
(系统自动生成,下载前可以参看下载内容)
下载文件列表
comb
....\comb.cpp
....\comb.dsp
....\comb.dsw
....\comb.ncb
....\comb.opt
....\comb.plg
....\Debug
....\ReadMe.txt
....\StdAfx.cpp
....\StdAfx.h
....\comb.cpp
....\comb.dsp
....\comb.dsw
....\comb.ncb
....\comb.opt
....\comb.plg
....\Debug
....\ReadMe.txt
....\StdAfx.cpp
....\StdAfx.h