代码搜索:递归回溯
找到约 2,805 项符合「递归回溯」的源代码
代码结果 2,805
www.eeworm.com/read/133757/14025424
c recursion.c
/* 递归法将整数转换成字符 */
# include
void convert(int n)
{
int i;
if((i=n/10) != 0)
convert(i);
putchar(n%10+'0');
}
void main()
{
int number;
printf("输入整数:");
scanf("%d", &n
www.eeworm.com/read/133210/14052117
h subg.h
#include
#include "g.cpp"
class sub_G:public G{
public:
void read_G_from(ifstream &infile); //从文件中读取产生式
void remove_leftDG(); //消除左递归
void write_G_to(of
www.eeworm.com/read/204479/15337778
c simknap_nrec.c
/* 简化背包问题的非递归算法*/
#include
#include
#define MAXNUM 20
#define TRUE 1
#define FALSE 0
struct NodeBag { /* 栈中元素的定义 */
int s , n ;
int r ; /* r的值
www.eeworm.com/read/204479/15337796
c bintree_inorder_rec.c
/* 二叉树对称根周游的递归算法*/
#include
#include
typedef char DataType;
struct BinTreeNode; /* 二叉树中结点 */
typedef struct BinTreeNode *PBinTreeNode; /* 结点的指针类
www.eeworm.com/read/111220/15516722
c recursion.c
/* 递归法将整数转换成字符 */
# include
void convert(int n)
{
int i;
if((i=n/10) != 0)
convert(i);
putchar(n%10+'0');
}
void main()
{
int number;
printf("输入整数:");
scanf("%d", &n
www.eeworm.com/read/109003/15568877
c recursion.c
/* 递归法将整数转换成字符 */
# include
void convert(int n)
{
int i;
if((i=n/10) != 0)
convert(i);
putchar(n%10+'0');
}
void main()
{
int number;
printf("输入整数:");
scanf("%d", &n
www.eeworm.com/read/272894/10937074
dpr ex.dpr
{
刚学Euler,只会标准方法DFS,但由于空间问题开不了邻接矩阵.
拖了好久,后来发现,本题给了现成的圈,Euler就是圈套圈,即圈上的一个结点可以展开为另一个圈.
所以只要直接做,就是对于递归处理圈,对于圈上的点,能展开则展开,用递归处理展开.处理过的圈打上标记就是了.
}
program Ural_1137(Input,Output);
const
MaxN=100; ...
www.eeworm.com/read/313343/13590003
txt pascal.txt
我们都知道八皇后问题是一个很经典的问题,当时很多解决八皇后问题的编程解法都是用递归解法,下面我用非递归的解法来实现如下:
其中有关设置标志位来表示该位是否可以下皇后的原理,请看郑启华的《pascal程序设计(第二版)>〉清华大学出版社出版的。代码如下:
#include
#define available 1 //用来标志该位是否可用,availabel表示可用,unaila ...
www.eeworm.com/read/386830/8723768
cpp select.cpp
#include
using namespace std;
bool equ_rows(int a[], int b[], int n)//递归
{
if(a[n-1]!=b[n-1]) return false;
else if(n==1) return true;
else equ_rows(a,b,n-1);
}
bool equ_loop(
www.eeworm.com/read/286602/8757130
txt 例4.11.txt
例4.11 用递归方法求n!。
有了例4.10的基础,很容易写出本题的程序:
#include
using namespace std;
long fac(int); //函数声明
int main( )
{int n; //n为需要求阶乘的整数