- 博客(7)
- 收藏
- 关注
原创 用循环和栈代替递归Demo
用循环和栈代替递归DemoQ:将上图的数据结构转换为如下要求:循环中嵌套递归:public function recursion($arr, $str){ for($i = 0; $i < count($arr); $i++){ $newstr = $str + '->'+ $arr[$i]['resource_n
2016-06-12 14:46:09 1407
原创 动态规划-最大连续乘积子数组
最大连续乘积子序列#include #define LENGTH 8#define min(n1, n2) (n1 > n2 ? n2 : n1)#define max(n1, n2) (n1 > n2 ? n1 : n2)double MaxProSub(double a[], int length);int main(){ double arr[LENGTH] = {-2.5, 4,
2016-06-08 16:50:29 968
原创 从爬楼梯到动态规划
http://mp.weixin.qq.com/s?__biz=MzI2NjA3NTc4Ng==&mid=402962373&idx=1&sn=15589545f7072583d0f65f2f6b1f3840&scene=23&srcid=0315hG6Qnn14H0VOTjinKZCr#rd
2016-03-16 10:02:51 514
原创 数组index
1. 数组index与数组名的位置关系 a[b] = *(a + b) = *(b + a) = b[a] int a[5] = {1, 2, 3, 4, 5}; printf("%d\n", 3[a]); putchar(2["abcdf"]);输出分别为 4 和 c
2016-03-11 10:38:06 696
原创 图的深度搜索和广度搜索
#include #include #include #include "queue.h"typedef struct _graph_node_ { int data; struct _graph_node_ *next;}gnode_t;typedef struct _adjlist_graph_ { gnode_t *relation; int vn; char *v
2016-03-10 22:18:10 758
原创 回溯法求解素数环
#include#include#define n 16int num = 0;int A[n] = {0};int isp[n*2] = {0};int vis[n] = {0};void dfs(int cur){ int i; if(cur == n && isp[A[0] + A[n-1]]){ //递归边界。测试第一个数和最后一个数
2016-03-10 22:16:15 1018
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人