文件名称:comb
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:8.83kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
一、 程序作用
实现排列组合功能。
例如:如果允许出现的数字为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/StdAfx.h
comb/StdAfx.cpp
comb/ReadMe.txt
comb/comb.dsp
comb/comb.dsw
comb/comb.ncb
comb/comb.plg
comb/comb.cpp
comb/comb.opt
comb/Debug
comb
comb/StdAfx.cpp
comb/ReadMe.txt
comb/comb.dsp
comb/comb.dsw
comb/comb.ncb
comb/comb.plg
comb/comb.cpp
comb/comb.opt
comb/Debug
comb
1999-2046 搜珍网 All Rights Reserved.
本站作为网络服务提供者,仅为网络服务对象提供信息存储空间,仅对用户上载内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。